Skip to content

Instantly share code, notes, and snippets.

@eXpl0it3r
Created March 14, 2021 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eXpl0it3r/a9c7c88aa59f995f72a5420f5d17ed55 to your computer and use it in GitHub Desktop.
Save eXpl0it3r/a9c7c88aa59f995f72a5420f5d17ed55 to your computer and use it in GitHub Desktop.
Link zlib
find_package(zlib)
if (NOT zlib_FOUND)
message("Fetch zlib content instead...")
include(FetchContent)
FetchContent_Declare(
zlib
GIT_REPOSITORY "https://github.com/madler/zlib.git"
GIT_TAG "v1.2.11"
)
FetchContent_GetProperties(zlib)
if (NOT zlib_POPULATED)
FetchContent_Populate(zlib)
add_subdirectory(${zlib_SOURCE_DIR} ${zlib_BINARY_DIR})
endif()
target_include_directories(mytarget PUBLIC ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR})
endif()
target_link_libraries(mytarget zlibstatic)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment