Skip to content

Commit

Permalink
CMake enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
paullouisageneau committed May 14, 2024
1 parent 1f5cd70 commit d119edb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
30 changes: 21 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,28 +152,40 @@ install(TARGETS juice EXPORT LibJuiceTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

install(TARGETS juice-static EXPORT LibJuiceTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
OPTIONAL
)

install(FILES ${LIBJUICE_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/juice)

# Export Targets
# Export targets
install(
EXPORT LibJuiceTargets
FILE LibJuiceTargets.cmake
NAMESPACE LibJuice::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LibJuice
)

# Export config
install(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/LibJuiceConfig.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LibJuice
)

include(CMakePackageConfigHelpers)
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/LibJuiceConfig.cmake.in
${CMAKE_BINARY_DIR}/LibJuiceConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LibJuice
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
write_basic_package_version_file(
${CMAKE_BINARY_DIR}/LibJuiceConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion)
install(FILES ${CMAKE_BINARY_DIR}/LibJuiceConfigVersion.cmake
COMPATIBILITY SameMajorVersion
)
# Export config and version files
install(FILES
${CMAKE_BINARY_DIR}/LibJuiceConfig.cmake
${CMAKE_BINARY_DIR}/LibJuiceConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LibJuice)

set_target_properties(juice PROPERTIES C_VISIBILITY_PRESET hidden)
Expand Down
2 changes: 2 additions & 0 deletions cmake/LibJuiceConfig.cmake → cmake/LibJuiceConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/LibJuiceTargets.cmake")

0 comments on commit d119edb

Please sign in to comment.