Skip to content

Commit

Permalink
Use CMakePackageConfigHelpers to write package config/version files
Browse files Browse the repository at this point in the history
  • Loading branch information
ZedThree committed Nov 19, 2020
1 parent 6cd50df commit 30dc135
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 25 deletions.
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@ if (PFUNIT_FOUND)
add_subdirectory(tests EXCLUDE_FROM_ALL)
endif ()

configure_file(GFTLConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/GFTLConfig.cmake @ONLY)
configure_file(GFTLConfig-version.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/GFTLConfig-version.cmake @ONLY)
include(CMakePackageConfigHelpers)
configure_package_config_file(GFTLConfig.cmake.in GFTLConfig.cmake
INSTALL_DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/GFTLConfig.cmake
)
write_basic_package_version_file(GFTLConfig-version.cmake
VERSION ${PACKAGE_VERSION}
COMPATIBILITY SameMajorVersion
)

set (top_dir "GFTL-${GFTL_VERSION_MAJOR}.${GFTL_VERSION_MINOR}")
install (
Expand Down
19 changes: 0 additions & 19 deletions GFTLConfig-version.cmake.in

This file was deleted.

7 changes: 3 additions & 4 deletions GFTLConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Package configuration file

get_filename_component (SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set (PREFIX ${SELF_DIR}/../..)
set (GFTL_TOP_DIR ${PREFIX}/GFTL-@GFTL_VERSION_MAJOR@.@GFTL_VERSION_MINOR@ CACHE PATH "")
include ("${GFTL_TOP_DIR}/cmake/GFTL.cmake")
@PACKAGE_INIT@

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

0 comments on commit 30dc135

Please sign in to comment.