From 2aa9a573a0dbe6ff694e3bf8f3e20c96a56ba087 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Tue, 22 Jun 2021 16:32:55 -0400 Subject: [PATCH] Fix zlib install --- CMakeLists.txt | 11 +++++++---- extern/CMakeLists.txt | 1 - extern/zlib/CMakeLists.txt | 6 +++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 61cb9e9..70eed37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -226,7 +226,7 @@ target_include_directories(athena-core PUBLIC target_link_libraries(athena-core PUBLIC athena-libyaml fmt - ${ZLIB_LIBRARIES} + $ ) add_library(athena-sakura EXCLUDE_FROM_ALL @@ -332,8 +332,11 @@ endforeach() # Define installs install(DIRECTORY include/athena DESTINATION ${INSTALL_INCLUDE_DIR} COMPONENT athena) install(DIRECTORY extern/fmt/include/fmt DESTINATION ${INSTALL_INCLUDE_DIR} COMPONENT athena) -install(TARGETS athena-core fmt - DESTINATION ${INSTALL_LIB_DIR} EXPORT AthenaTargets COMPONENT athena) +if (ATHENA_ZLIB) + set(ZLIB_INSTALL ${ZLIB_LIBRARIES}) +endif () +install(TARGETS athena-core fmt ${ZLIB_INSTALL} + DESTINATION ${INSTALL_LIB_DIR} EXPORT AthenaTargets COMPONENT athena) if(WIN32 AND NOT CYGWIN) install(FILES Athena.ico DESTINATION ${INSTALL_LIB_DIR} COMPONENT athena) elseif(UNIX) @@ -348,7 +351,7 @@ endif() ################## # Add all targets to the build-tree export set -export(TARGETS athena-core athena-libyaml fmt FILE "${CMAKE_CURRENT_BINARY_DIR}/AthenaTargets.cmake") +export(TARGETS athena-core athena-libyaml fmt ${ZLIB_LIBRARIES} FILE "${CMAKE_CURRENT_BINARY_DIR}/AthenaTargets.cmake") # Export the package for use from the build-tree # (this registers the build-tree with a global CMake-registry) diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index b497fbb..e5dbc45 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -7,7 +7,6 @@ add_subdirectory(yaml) if(NOT TARGET fmt) add_subdirectory(fmt) target_compile_definitions(fmt PUBLIC - FMT_STRING_ALIAS=1 FMT_ARM_ABI_COMPATIBILITY=1 FMT_EXCEPTIONS=0) target_compile_definitions(fmt INTERFACE diff --git a/extern/zlib/CMakeLists.txt b/extern/zlib/CMakeLists.txt index 54f5300..83da17b 100644 --- a/extern/zlib/CMakeLists.txt +++ b/extern/zlib/CMakeLists.txt @@ -4,8 +4,11 @@ if (APPLE) endif () find_package(ZLIB ${ZLIB_REQUIRED}) if (ZLIB_FOUND) - add_library(z ALIAS ZLIB::ZLIB) # alias hack to allow use from global context + add_library(z INTERFACE) + target_link_libraries(z INTERFACE ${ZLIB_LIBRARIES}) + target_include_directories(z INTERFACE ${ZLIB_INCLUDE_DIRS}) set(ZLIB_LIBRARIES z CACHE STRING "zlib libraries" FORCE) + set(ATHENA_ZLIB NO CACHE BOOL "Using built-in zlib" FORCE) else () message(STATUS "Using Athena's built-in zlib") add_library(z @@ -39,4 +42,5 @@ else () endif () target_include_directories(z INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) set(ZLIB_LIBRARIES z CACHE STRING "zlib libraries" FORCE) + set(ATHENA_ZLIB YES CACHE BOOL "Using built-in zlib" FORCE) endif ()