File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,26 +81,30 @@ find_package(CUDAToolkit REQUIRED)
8181include (FetchContent )
8282
8383# 1. ZLIB Configuration
84+
85+ set (BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE )
8486find_package (ZLIB QUIET )
8587if (NOT ZLIB_FOUND)
8688 FetchContent_Declare (
8789 zlib
8890 GIT_REPOSITORY https://github.com/madler/zlib.git
8991 GIT_TAG v1.3
9092 )
91- FetchContent_MakeAvailable (zlib)
9293
93- if (TARGET zlibstatic)
94- target_compile_definitions (zlibstatic INTERFACE
95- $<$<PLATFORM_ID :Windows >:ZLIB_STATIC_LINKING >
96- )
97-
98- if (TARGET example)
99- target_link_libraries (example PRIVATE zlibstatic )
100- target_compile_definitions (example PRIVATE ZLIB_STATIC_LINKING )
101- endif ()
94+ FetchContent_GetProperties (zlib)
95+ if (NOT zlib_POPULATED)
96+ FetchContent_Populate (zlib)
10297
98+ file (WRITE "${zlib_SOURCE_DIR} /zlib.pc.cmakein" "" )
99+ add_subdirectory (${zlib_SOURCE_DIR} ${zlib_BINARY_DIR} EXCLUDE_FROM_ALL )
100+ endif ()
101+
102+ if (TARGET zlibstatic)
103103 add_library (ZLIB::ZLIB ALIAS zlibstatic )
104+ target_include_directories (zlibstatic INTERFACE
105+ $<BUILD_INTERFACE :${zlib_SOURCE_DIR} >
106+ $<BUILD_INTERFACE :${zlib_BINARY_DIR} >
107+ )
104108 endif ()
105109endif ()
106110
You can’t perform that action at this time.
0 commit comments