When building intree zlib, build zlibstatic not shared.

This commit is contained in:
James Benton 2018-06-14 14:06:03 +01:00
parent b48055dcb5
commit 2420cf70d5
6 changed files with 11 additions and 16 deletions

View File

@ -9,6 +9,6 @@ add_executable(elf2rpl
target_link_libraries(elf2rpl target_link_libraries(elf2rpl
excmd excmd
fmt fmt
zlib) zlibstatic)
install(TARGETS elf2rpl RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") install(TARGETS elf2rpl RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")

View File

@ -11,16 +11,15 @@ find_package(ZLIB QUIET)
if(NOT ZLIB_FOUND) if(NOT ZLIB_FOUND)
# Disable zlib install # Disable zlib install
set(SKIP_INSTALL_ALL 1) set(SKIP_INSTALL_ALL 1)
set(BUILD_SHARED_LIBS OFF)
add_subdirectory(zlib) add_subdirectory(zlib)
target_include_directories(zlib INTERFACE target_include_directories(zlibstatic INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/zlib" "${CMAKE_CURRENT_SOURCE_DIR}/zlib"
"${CMAKE_CURRENT_BINARY_DIR}/zlib") "${CMAKE_CURRENT_BINARY_DIR}/zlib")
install(FILES "${CMAKE_BINARY_DIR}/bin/zlib.dll"
DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
else() else()
add_library(zlib INTERFACE) # Not actually static, but who cares...
target_link_libraries(zlib INTERFACE ${ZLIB_LIBRARIES}) add_library(zlibstatic INTERFACE)
target_include_directories(zlib INTERFACE ${ZLIB_INCLUDE_DIR}) target_link_libraries(zlibstatic INTERFACE ${ZLIB_LIBRARIES})
target_include_directories(zlibstatic INTERFACE ${ZLIB_INCLUDE_DIR})
endif() endif()

View File

@ -13,6 +13,6 @@ add_executable(readrpl
target_link_libraries(readrpl target_link_libraries(readrpl
excmd excmd
fmt fmt
zlib) zlibstatic)
install(TARGETS readrpl RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") install(TARGETS readrpl RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")

View File

@ -4,6 +4,6 @@ add_executable(rplexportgen
rplexportgen.cpp) rplexportgen.cpp)
target_link_libraries(rplexportgen target_link_libraries(rplexportgen
zlib) zlibstatic)
install(TARGETS rplexportgen RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") install(TARGETS rplexportgen RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")

View File

@ -4,6 +4,6 @@ add_executable(rplimportgen
rplimportgen.cpp) rplimportgen.cpp)
target_link_libraries(rplimportgen target_link_libraries(rplimportgen
zlib) zlibstatic)
install(TARGETS rplimportgen RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") install(TARGETS rplimportgen RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")

View File

@ -1,11 +1,7 @@
project(udplogserver) project(udplogserver)
file(GLOB_RECURSE SOURCE_FILES *.cpp)
file(GLOB_RECURSE HEADER_FILES *.h)
add_executable(udplogserver add_executable(udplogserver
${SOURCE_FILES} main.cpp)
${HEADER_FILES})
if(MSVC) if(MSVC)
target_link_libraries(udplogserver PRIVATE ws2_32) target_link_libraries(udplogserver PRIVATE ws2_32)