From 2420cf70d55208d18e8813f50bedcaed97f756eb Mon Sep 17 00:00:00 2001 From: James Benton Date: Thu, 14 Jun 2018 14:06:03 +0100 Subject: [PATCH] When building intree zlib, build zlibstatic not shared. --- tools/elf2rpl/CMakeLists.txt | 2 +- tools/libraries/CMakeLists.txt | 13 ++++++------- tools/readrpl/CMakeLists.txt | 2 +- tools/rplexportgen/CMakeLists.txt | 2 +- tools/rplimportgen/CMakeLists.txt | 2 +- tools/udplogserver/CMakeLists.txt | 6 +----- 6 files changed, 11 insertions(+), 16 deletions(-) diff --git a/tools/elf2rpl/CMakeLists.txt b/tools/elf2rpl/CMakeLists.txt index b705a6c..ed1ac1c 100644 --- a/tools/elf2rpl/CMakeLists.txt +++ b/tools/elf2rpl/CMakeLists.txt @@ -9,6 +9,6 @@ add_executable(elf2rpl target_link_libraries(elf2rpl excmd fmt - zlib) + zlibstatic) install(TARGETS elf2rpl RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") diff --git a/tools/libraries/CMakeLists.txt b/tools/libraries/CMakeLists.txt index 1f9ddab..31470c3 100644 --- a/tools/libraries/CMakeLists.txt +++ b/tools/libraries/CMakeLists.txt @@ -11,16 +11,15 @@ find_package(ZLIB QUIET) if(NOT ZLIB_FOUND) # Disable zlib install set(SKIP_INSTALL_ALL 1) + set(BUILD_SHARED_LIBS OFF) add_subdirectory(zlib) - target_include_directories(zlib INTERFACE + target_include_directories(zlibstatic INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/zlib" "${CMAKE_CURRENT_BINARY_DIR}/zlib") - - install(FILES "${CMAKE_BINARY_DIR}/bin/zlib.dll" - DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") else() - add_library(zlib INTERFACE) - target_link_libraries(zlib INTERFACE ${ZLIB_LIBRARIES}) - target_include_directories(zlib INTERFACE ${ZLIB_INCLUDE_DIR}) + # Not actually static, but who cares... + add_library(zlibstatic INTERFACE) + target_link_libraries(zlibstatic INTERFACE ${ZLIB_LIBRARIES}) + target_include_directories(zlibstatic INTERFACE ${ZLIB_INCLUDE_DIR}) endif() diff --git a/tools/readrpl/CMakeLists.txt b/tools/readrpl/CMakeLists.txt index c4d0b0c..e56006e 100644 --- a/tools/readrpl/CMakeLists.txt +++ b/tools/readrpl/CMakeLists.txt @@ -13,6 +13,6 @@ add_executable(readrpl target_link_libraries(readrpl excmd fmt - zlib) + zlibstatic) install(TARGETS readrpl RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") diff --git a/tools/rplexportgen/CMakeLists.txt b/tools/rplexportgen/CMakeLists.txt index ddb89ef..922d088 100644 --- a/tools/rplexportgen/CMakeLists.txt +++ b/tools/rplexportgen/CMakeLists.txt @@ -4,6 +4,6 @@ add_executable(rplexportgen rplexportgen.cpp) target_link_libraries(rplexportgen - zlib) + zlibstatic) install(TARGETS rplexportgen RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") diff --git a/tools/rplimportgen/CMakeLists.txt b/tools/rplimportgen/CMakeLists.txt index 1969666..1e97a6d 100644 --- a/tools/rplimportgen/CMakeLists.txt +++ b/tools/rplimportgen/CMakeLists.txt @@ -4,6 +4,6 @@ add_executable(rplimportgen rplimportgen.cpp) target_link_libraries(rplimportgen - zlib) + zlibstatic) install(TARGETS rplimportgen RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") diff --git a/tools/udplogserver/CMakeLists.txt b/tools/udplogserver/CMakeLists.txt index 779bcb7..17e9d1a 100644 --- a/tools/udplogserver/CMakeLists.txt +++ b/tools/udplogserver/CMakeLists.txt @@ -1,11 +1,7 @@ project(udplogserver) -file(GLOB_RECURSE SOURCE_FILES *.cpp) -file(GLOB_RECURSE HEADER_FILES *.h) - add_executable(udplogserver - ${SOURCE_FILES} - ${HEADER_FILES}) + main.cpp) if(MSVC) target_link_libraries(udplogserver PRIVATE ws2_32)