diff options
author | Naios <naios-dev@live.de> | 2016-03-14 15:27:33 +0100 |
---|---|---|
committer | Naios <naios-dev@live.de> | 2016-03-18 02:52:54 +0100 |
commit | 1a572d242593124f986d3ed08710b96a142a6763 (patch) | |
tree | bbc1cdcadfb678ce915fc02e18a9926bfb51c1d0 /dep/zlib | |
parent | 87bc353b3446fb95e141d44fe49da3e5059f7436 (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
Diffstat (limited to 'dep/zlib')
-rw-r--r-- | dep/zlib/CMakeLists.txt | 55 |
1 files changed, 38 insertions, 17 deletions
diff --git a/dep/zlib/CMakeLists.txt b/dep/zlib/CMakeLists.txt index 7feb134bcd5..b3e3d58fe55 100644 --- a/dep/zlib/CMakeLists.txt +++ b/dep/zlib/CMakeLists.txt @@ -8,22 +8,43 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -SET(zlib_STAT_SRCS - adler32.c - compress.c - crc32.c - deflate.c - infback.c - inffast.c - inflate.c - inftrees.c - trees.c - uncompr.c - zutil.c -) +if(UNIX) + # Look for an installed zlib on unix + find_package(ZLIB REQUIRED) -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} -) + add_library(zlib SHARED IMPORTED GLOBAL) -add_library(zlib STATIC ${zlib_STAT_SRCS}) + set_target_properties(zlib + PROPERTIES + IMPORTED_LOCATION + "${ZLIB_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES + "${ZLIB_INCLUDE_DIRS}") +else() + # Use the bundled source on windows + SET(zlib_STAT_SRCS + adler32.c + compress.c + crc32.c + deflate.c + infback.c + inffast.c + inflate.c + inftrees.c + trees.c + uncompr.c + zutil.c + ) + + add_library(zlib STATIC + ${zlib_STAT_SRCS}) + + target_include_directories(zlib + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}) + + set_target_properties(zlib + PROPERTIES + FOLDER + "dep") +endif() |