diff options
author | Naios <naios-dev@live.de> | 2016-03-14 15:27:33 +0100 |
---|---|---|
committer | Naios <naios-dev@live.de> | 2016-03-19 23:19:50 +0100 |
commit | b0ac332d58cc7d7e2da4ba26efc2f3416c674784 (patch) | |
tree | adf5cf58803efeb51650c2da754278c2cc2f6c27 /dep/readline/CMakeLists.txt | |
parent | fee9bb904a5dcfc93e6ea85789b5aacc203a440a (diff) |
CMake: Provide proper interface targets from dependencies
* to make use of cmakes inherited link dependencies which
imports all include directories/ definitions from the link library
(cherry picked from commit 1a572d242593124f986d3ed08710b96a142a6763)
Diffstat (limited to 'dep/readline/CMakeLists.txt')
-rw-r--r-- | dep/readline/CMakeLists.txt | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/dep/readline/CMakeLists.txt b/dep/readline/CMakeLists.txt new file mode 100644 index 00000000000..0e8679ba718 --- /dev/null +++ b/dep/readline/CMakeLists.txt @@ -0,0 +1,38 @@ +# Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/> +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +if( UNIX ) + # find Readline (terminal input library) includes and library + # + # READLINE_INCLUDE_DIR - where the directory containing the READLINE headers can be found + # READLINE_LIBRARY - full path to the READLINE library + find_path(READLINE_INCLUDE_DIR readline/readline.h) + find_library(READLINE_LIBRARY NAMES readline) + + message(STATUS "Found Readline library: ${READLINE_LIBRARY}") + message(STATUS "Include dir is: ${READLINE_INCLUDE_DIR}") + + if (NOT READLINE_INCLUDE_DIR OR NOT READLINE_LIBRARY) + message(FATAL_ERROR "** Readline library not found!\n** Your distro may provide a binary for Readline e.g. for ubuntu try apt-get install libreadline5-dev") + endif () + + add_library(readline SHARED IMPORTED GLOBAL) + + set_target_properties(readline + PROPERTIES + IMPORTED_LOCATION + "${READLINE_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES + "${READLINE_INCLUDE_DIR}") + +else() + # Provide a dummy target + add_library(readline INTERFACE) +endif() |