diff --git a/cmake-init/templates/common/cmake/install-config.cmake b/cmake-init/templates/common/cmake/install-config.cmake index a966dfd..0a96ba5 100644 --- a/cmake-init/templates/common/cmake/install-config.cmake +++ b/cmake-init/templates/common/cmake/install-config.cmake @@ -1,6 +1,8 @@ -{% if pm %}include(CMakeFindDependencyMacro) +{% if pm %}set({= name =}_FOUND YES) + +include(CMakeFindDependencyMacro) find_dependency({% if c %}json-c{% else %}fmt{% end %}) -if({% if c %}json-c{% else %}fmt{% end %}_FOUND) +if({= name =}_FOUND) {% end %}include("${CMAKE_CURRENT_LIST_DIR}/{= name =}Targets.cmake"){% if pm %} endif(){% end %} diff --git a/cmake-init/templates/common/cmake/install-rules.cmake b/cmake-init/templates/common/cmake/install-rules.cmake index 5d4ae8c..17c837f 100644 --- a/cmake-init/templates/common/cmake/install-rules.cmake +++ b/cmake-init/templates/common/cmake/install-rules.cmake @@ -12,7 +12,8 @@ set(CMAKE_INSTALL_LIBDIR lib CACHE PATH ""){% end %} include(CMakePackageConfigHelpers) include(GNUInstallDirs) -# find_package() call for consumers to find this project +# find_package() call for consumers to find this project{% if pm %} +# should match the name of variable set in the install-config.cmake script{% end %} set(package {= name =}) install(