Skip to content

Commit 82b0c51

Browse files
michaelmalonenzrandy408
authored andcommitted
cmake: make finding zlib in-tree easier
When building libspng as a sub-module alongside zlib as a sub-module, then it becomes much easier to locate the in-tree zlib when the ZLIB_ROOT variable can be set to ${zlib_BINARY_DIR}. This is especially useful when building on Windows where zlib-dev typically isn't installed.
1 parent 0bd962b commit 82b0c51

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ option(BUILD_EXAMPLES "Build examples" ON)
1414

1515
include(GNUInstallDirs)
1616

17+
# Allow the usage of [PackageName]_ROOT variables for FindPackage
18+
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12")
19+
cmake_policy(SET CMP0074 NEW)
20+
endif()
21+
1722
find_package(ZLIB REQUIRED)
1823
include_directories(${ZLIB_INCLUDE_DIRS})
1924

0 commit comments

Comments
 (0)