Skip to content

Commit 985ae38

Browse files
committed
Use configure_package_config_file over configure_file
Fixes #47
1 parent 518c888 commit 985ae38

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,10 @@ function(packageProject)
162162

163163
mark_as_advanced("${PROJECT_NAME}_INSTALL_CMAKEDIR")
164164

165-
configure_file(
165+
configure_package_config_file(
166166
${PACKAGE_PROJECT_ROOT_PATH}/Config.cmake.in
167-
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config.cmake" @ONLY
167+
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config.cmake"
168+
INSTALL_DESTINATION "${${PROJECT_NAME}_INSTALL_CMAKEDIR}"
168169
)
169170

170171
install(

Config.cmake.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@PACKAGE_INIT@
2+
13
include(CMakeFindDependencyMacro)
24

35
# ##################################################################################################
@@ -39,3 +41,9 @@ foreach(dependency ${SEPARATE_DEPENDENCIES})
3941
endforeach()
4042

4143
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
44+
45+
# ##################################################################################################
46+
# Final checks
47+
# ##################################################################################################
48+
49+
check_required_components("${PROJECT_NAME}")

0 commit comments

Comments
 (0)