Skip to content

Commit 2dc2ffb

Browse files
fran6coTom94
authored andcommitted
Build: Generate CMake package version file (btzy#173)
The version file specifies that releases with the same major version are backward compatible.
1 parent 28c7512 commit 2dc2ffb

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ set_target_properties(${TARGET_NAME} PROPERTIES
132132

133133
if (NFD_INSTALL)
134134
include(GNUInstallDirs)
135+
include(CMakePackageConfigHelpers)
136+
137+
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}-config-version.cmake"
138+
VERSION "${PROJECT_VERSION}"
139+
COMPATIBILITY SameMajorVersion
140+
)
141+
142+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}-config-version.cmake" DESTINATION lib/cmake/${TARGET_NAME})
135143

136144
install(TARGETS ${TARGET_NAME} EXPORT ${TARGET_NAME}-export
137145
LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}

0 commit comments

Comments
 (0)