From b256f873ca0d21c1f798a50502097f3f0ef5f237 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 13 Apr 2018 08:02:26 -0400 Subject: [PATCH 1/2] CMakeLists: Link in zlib privately where applicable Also, use the target name introduced via find_package(ZLIB) instead of hardcoding the 'z' name in the link libraries. --- Externals/zlib/CMakeLists.txt | 1 + Source/Core/Core/CMakeLists.txt | 2 +- Source/Core/DiscIO/CMakeLists.txt | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Externals/zlib/CMakeLists.txt b/Externals/zlib/CMakeLists.txt index c95e282e00..e4e837ba77 100644 --- a/Externals/zlib/CMakeLists.txt +++ b/Externals/zlib/CMakeLists.txt @@ -77,3 +77,4 @@ set(ZLIB_SRCS ) add_library(z STATIC ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +add_library(ZLIB::ZLIB ALIAS z) diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index d42c959bc1..58a5254cb8 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -288,11 +288,11 @@ PUBLIC videonull videoogl videosoftware - z PRIVATE bdisasm ${LZO} + ZLIB::ZLIB ) if (APPLE) diff --git a/Source/Core/DiscIO/CMakeLists.txt b/Source/Core/DiscIO/CMakeLists.txt index 28c528f986..5dfbc5fd59 100644 --- a/Source/Core/DiscIO/CMakeLists.txt +++ b/Source/Core/DiscIO/CMakeLists.txt @@ -21,3 +21,8 @@ add_library(discio WiiSaveBanner.cpp WiiWad.cpp ) + +target_link_libraries(discio +PRIVATE + ZLIB::ZLIB +) From 2851c7e5ee4ede01a5a99cada1a2762f6ca52918 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 13 Apr 2018 08:14:56 -0400 Subject: [PATCH 2/2] CMakeLists: Don't dump zlib's includes into the top-level directory --- CMakeLists.txt | 2 -- Externals/zlib/CMakeLists.txt | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fdbf7bae4d..895f97b8c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -572,11 +572,9 @@ endif() find_package(ZLIB) if(ZLIB_FOUND) message(STATUS "Using shared zlib") - include_directories(${ZLIB_INCLUDE_DIRS}) else() message(STATUS "Shared zlib not found, falling back to the static library") add_subdirectory(Externals/zlib) - include_directories(Externals/zlib) endif() if(NOT APPLE) diff --git a/Externals/zlib/CMakeLists.txt b/Externals/zlib/CMakeLists.txt index e4e837ba77..a76e97b06a 100644 --- a/Externals/zlib/CMakeLists.txt +++ b/Externals/zlib/CMakeLists.txt @@ -78,3 +78,8 @@ set(ZLIB_SRCS add_library(z STATIC ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) add_library(ZLIB::ZLIB ALIAS z) + +target_include_directories(z +PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +)