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/zlib/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/zlib/CMakeLists.txt')
-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() |