Skip to content

Commit

Permalink
Update CMakeLists.txt
Browse files Browse the repository at this point in the history
add Config file
  • Loading branch information
prudhomm authored Nov 12, 2024
1 parent 3017ad7 commit 40aacbe
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ endif()

include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

set(NAPP_TARGET_NAME ${PROJECT_NAME})
set(NAPP_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
if(NOT DEFINED NAPP_CONFIG_INSTALL_DIR )
Expand Down Expand Up @@ -91,8 +92,26 @@ install(
EXPORT ${NAPP_TARGETS_EXPORT_NAME}
INCLUDES DESTINATION ${NAPP_INCLUDE_INSTALL_DIR}
)
# Install CMake package configuration files
write_basic_package_version_file(
"${NAPP_CMAKE_CONFIG_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)

configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in" # Create this file as explained below
"${NAPP_CMAKE_CONFIG_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${NAPP_CONFIG_INSTALL_DIR}
)
install(
EXPORT ${NAPP_TARGETS_EXPORT_NAME}
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${NAPP_CONFIG_INSTALL_DIR}
)
install(
FILES
"${NAPP_CMAKE_CONFIG_DIR}/${PROJECT_NAME}Config.cmake"
"${NAPP_CMAKE_CONFIG_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION ${NAPP_CONFIG_INSTALL_DIR}
)

0 comments on commit 40aacbe

Please sign in to comment.