aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt18
-rw-r--r--launcher/CMakeLists.txt3
2 files changed, 18 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 630cf0cf..3ed4d772 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -146,6 +146,10 @@ set(Launcher_BUILD_TIMESTAMP "${TODAY}")
################################ 3rd Party Libs ################################
+if(NOT Launcher_FORCE_BUNDLED_LIBS)
+ find_package(ZLIB QUIET)
+endif()
+
# Find the required Qt parts
include(QtVersionlessBackport)
if(Launcher_QT_VERSION_MAJOR EQUAL 5)
@@ -306,6 +310,20 @@ add_subdirectory(libraries/systeminfo) # system information library
add_subdirectory(libraries/hoedown) # markdown parser
add_subdirectory(libraries/launcher) # java based launcher part for Minecraft
add_subdirectory(libraries/javacheck) # java compatibility checker
+if(NOT ZLIB_FOUND)
+ message(STATUS "Using bundled 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")
+ set_target_properties(zlibstatic PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIR}")
+ add_library(ZLIB::ZLIB ALIAS zlibstatic)
+ set(ZLIB_LIBRARY ZLIB::ZLIB)
+ set(ZLIB_FOUND true)
+ find_package(ZLIB REQUIRED)
+else()
+ message(STATUS "Using system zlib")
+endif()
if (FORCE_BUNDLED_QUAZIP)
message(STATUS "Using bundled QuaZip")
set(BUILD_SHARED_LIBS 0) # link statically to avoid conflicts.
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index 7998f4f5..a54a25f9 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -539,9 +539,6 @@ set(ATLAUNCHER_SOURCES
################################ COMPILE ################################
-# we need zlib
-find_package(ZLIB REQUIRED)
-
set(LOGIC_SOURCES
${CORE_SOURCES}
${PATHMATCHER_SOURCES}