diff options
author | Brad King <brad.king@kitware.com> | 2011-07-26 18:56:22 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2011-07-26 18:56:22 (GMT) |
commit | 25a35f5686d7a72a4da8508be5d562c6c225664a (patch) | |
tree | 4616ff6957df31cf9fa2ea569cd98ec5ad92c1ad /Source | |
parent | e25c0d046af09776743e55035c4bf4e8f3a16b11 (diff) | |
parent | 4a50b5f2aaa6965f908f1a64c202cacf175eeb56 (diff) | |
download | CMake-25a35f5686d7a72a4da8508be5d562c6c225664a.zip CMake-25a35f5686d7a72a4da8508be5d562c6c225664a.tar.gz CMake-25a35f5686d7a72a4da8508be5d562c6c225664a.tar.bz2 |
Merge topic 'DisableSwitchForFindPackage'
4a50b5f Add a basic test for CMAKE_DISABLE_FIND_PACKAGE_<package>
a66df08 Add documentation for the CMAKE_DISABLE_FIND_PACKAGE_<Name> switch
6e1d3ed Add a switch to disable a find_package() call completely
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmDocumentVariables.cxx | 14 | ||||
-rw-r--r-- | Source/cmFindPackageCommand.cxx | 22 |
2 files changed, 36 insertions, 0 deletions
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index ea25e60..4e75f9c 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -719,6 +719,20 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "Variables That Change Behavior"); cm->DefineProperty + ("CMAKE_DISABLE_FIND_PACKAGE_<PackageName>", cmProperty::VARIABLE, + "Variable for disabling find_package() calls.", + "Every non-REQUIRED find_package() call in a project can be disabled " + "by setting the variable CMAKE_DISABLE_FIND_PACKAGE_<PackageName> to " + "TRUE. This can be used to build a project without an optional package, " + "although that package is installed.\n" + "This switch should be used during the initial CMake run. Otherwise if " + "the package has already been found in a previous CMake run, the " + "variables which have been stored in the cache will still be there. " + "In the case it is recommended to remove the cache variables for " + "this package from the cache using the cache editor or cmake -U", false, + "Variables That Change Behavior"); + + cm->DefineProperty ("CMAKE_USER_MAKE_RULES_OVERRIDE", cmProperty::VARIABLE, "Specify a CMake file that overrides platform information.", "CMake loads the specified file while enabling support for each " diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 5f106bc..9d1c220 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -335,6 +335,10 @@ void cmFindPackageCommand::GenerateDocumentation() this->CommandDocumentation += this->GenericDocumentationPathsOrder; this->CommandDocumentation += "\n" + "Every non-REQUIRED find_package() call can be disabled by setting the " + "variable CMAKE_DISABLE_FIND_PACKAGE_<package> to TRUE. See the " + "documentation for the CMAKE_DISABLE_FIND_PACKAGE_<package> variable for " + "more information.\n" "See the cmake_policy() command documentation for discussion of the " "NO_POLICY_SCOPE option." ; @@ -607,6 +611,24 @@ bool cmFindPackageCommand } } + std::string disableFindPackageVar = "CMAKE_DISABLE_FIND_PACKAGE_"; + disableFindPackageVar += this->Name; + if(this->Makefile->IsOn(disableFindPackageVar.c_str())) + { + if (this->Required) + { + cmOStringStream e; + e << "for module " << this->Name << " called with REQUIRED, but " + << disableFindPackageVar + << " is enabled. A REQUIRED package cannot be disabled."; + this->SetError(e.str().c_str()); + return false; + } + + return true; + } + + this->SetModuleVariables(components); // See if there is a Find<package>.cmake module. |