Fix zlib install

master
Luke Street 2 years ago
parent 4bd9dfac61
commit 2aa9a573a0
  1. 11
      CMakeLists.txt
  2. 1
      extern/CMakeLists.txt
  3. 6
      extern/zlib/CMakeLists.txt

@ -226,7 +226,7 @@ target_include_directories(athena-core PUBLIC
target_link_libraries(athena-core PUBLIC
athena-libyaml
fmt
${ZLIB_LIBRARIES}
$<BUILD_INTERFACE:${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)

@ -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

@ -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 ()

Loading…
Cancel
Save