Skip to content

Commit

Permalink
Add config for basic package version file
Browse files Browse the repository at this point in the history
Added CMake config to automatically generate version information file 
to be able to check if the correct version of the package is installed.
  • Loading branch information
PythonGermany authored and gjasny committed May 26, 2024
1 parent 0c76af1 commit 5b3e4d6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ install(
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)

write_basic_package_version_file(
"${PROJECT_NAME}-config-version.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)

configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/${PROJECT_NAME}-config.cmake.in"
${PROJECT_NAME}-config.cmake
Expand All @@ -155,7 +161,7 @@ configure_package_config_file(
)

install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)

Expand Down

0 comments on commit 5b3e4d6

Please sign in to comment.