diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-11-27 12:43:52 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-12-13 15:14:02 (GMT) |
commit | 20cafa2e1faff577143eb56d14e5c3998cb7d6a9 (patch) | |
tree | ee6f37c3dbebde1bdad318ee503ed5214fb9a561 /Modules/CMakePackageConfigHelpers.cmake | |
parent | d05e0aa845a99d2a04f61578ba9882ba9a2949c4 (diff) | |
download | CMake-20cafa2e1faff577143eb56d14e5c3998cb7d6a9.zip CMake-20cafa2e1faff577143eb56d14e5c3998cb7d6a9.tar.gz CMake-20cafa2e1faff577143eb56d14e5c3998cb7d6a9.tar.bz2 |
Split the find_dependency macro into a separate file.
This allows Config file authors to use it without having to use
CONFIGURE_PACKAGE_CONFIG_FILE.
Diffstat (limited to 'Modules/CMakePackageConfigHelpers.cmake')
-rw-r--r-- | Modules/CMakePackageConfigHelpers.cmake | 35 |
1 files changed, 4 insertions, 31 deletions
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake index 855af9c..2c1c613 100644 --- a/Modules/CMakePackageConfigHelpers.cmake +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -196,11 +196,13 @@ include(CMakeParseArguments) include(WriteBasicConfigVersionFile) +include(CMakeFindDependencyMacro) macro(WRITE_BASIC_PACKAGE_VERSION_FILE) write_basic_config_version_file(${ARGN}) endmacro() +set(cfpch_dir ${CMAKE_CURRENT_LIST_DIR}) function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO NO_FIND_DEPENDENCY_MACRO) @@ -290,37 +292,8 @@ endmacro() endif() if(NOT CCF_NO_FIND_DEPENDENCY_MACRO) - set(PACKAGE_INIT "${PACKAGE_INIT} -macro(find_dependency dep) - if (NOT \${dep}_FOUND) - if (\${ARGV1}) - set(version \${ARGV1}) - endif() - set(exact_arg) - if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION_EXACT) - set(exact_arg EXACT) - endif() - set(quiet_arg) - if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - set(quiet_arg QUIET) - endif() - set(required_arg) - if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) - set(required_arg REQUIRED) - endif() - - find_package(\${dep} \${version} \${exact_arg} \${quiet_arg} \${required_arg}) - if (NOT \${dep}_FOUND) - set(\${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE \"\${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency \${dep} could not be found.\") - set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND False) - return() - endif() - set(required_arg) - set(quiet_arg) - set(exact_arg) - endif() -endmacro() -") + file(READ "${cfpch_dir}/CMakeFindDependencyMacro.cmake" find_dependency_macro) + set(PACKAGE_INIT "${PACKAGE_INIT} ${find_dependency_macro}") endif() set(PACKAGE_INIT "${PACKAGE_INIT} |