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} +)