diff options
author | TheLastRar <TheLastRar@users.noreply.github.com> | 2023-01-08 18:12:14 +0000 |
---|---|---|
committer | TheLastRar <TheLastRar@users.noreply.github.com> | 2023-01-22 15:04:15 +0000 |
commit | 2a949fcb867ca86594481780101edb37409e8198 (patch) | |
tree | cfb56efe0d6ac86d9a774bd144b3fecc11879fb8 /CMakeLists.txt | |
parent | b9df10c8bd520b4177d3e0cbbc7efe6cbe1da22c (diff) | |
download | PrismLauncher-2a949fcb867ca86594481780101edb37409e8198.tar.gz PrismLauncher-2a949fcb867ca86594481780101edb37409e8198.tar.bz2 PrismLauncher-2a949fcb867ca86594481780101edb37409e8198.zip |
fix: zlib fallback
Signed-off-by: TheLastRar <TheLastRar@users.noreply.github.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2194317b..f32a73d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -208,9 +208,15 @@ set(Launcher_BUILD_TIMESTAMP "${TODAY}") ################################ 3rd Party Libs ################################ -if(NOT Launcher_FORCE_BUNDLED_LIBS) +# Successive configurations of cmake without cleaning the build dir will cause zlib fallback to fail due to cached values +# Record when fallback triggered and skip this find_package +if(NOT Launcher_FORCE_BUNDLED_LIBS AND NOT FORCE_BUNDLED_ZLIB) find_package(ZLIB QUIET) endif() +if(NOT ZLIB_FOUND) + set(FORCE_BUNDLED_ZLIB TRUE CACHE BOOL "") + mark_as_advanced(FORCE_BUNDLED_ZLIB) +endif() # Find the required Qt parts include(QtVersionlessBackport) @@ -379,13 +385,14 @@ add_subdirectory(libraries/libnbtplusplus) add_subdirectory(libraries/systeminfo) # system information library add_subdirectory(libraries/launcher) # java based launcher part for Minecraft add_subdirectory(libraries/javacheck) # java compatibility checker -if(NOT ZLIB_FOUND) +if(FORCE_BUNDLED_ZLIB) message(STATUS "Using bundled zlib") + set(CMAKE_POLICY_DEFAULT_CMP0069 NEW) # Suppress cmake warnings and allow INTERPROCEDURAL_OPTIMIZATION for zlib set(SKIP_INSTALL_ALL ON) add_subdirectory(libraries/zlib EXCLUDE_FROM_ALL) - set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries/zlib" "${CMAKE_CURRENT_BINARY_DIR}/libraries/zlib" CACHE STRING "") + set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries/zlib" "${CMAKE_CURRENT_BINARY_DIR}/libraries/zlib" CACHE STRING "" FORCE) set_target_properties(zlibstatic PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIR}") add_library(ZLIB::ZLIB ALIAS zlibstatic) set(ZLIB_LIBRARY ZLIB::ZLIB CACHE STRING "zlib library name") |