diff options
author | Brad King <brad.king@kitware.com> | 2008-06-09 15:58:29 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-06-09 15:58:29 (GMT) |
commit | 6706f84cd997d39026080e47e4944072add7f925 (patch) | |
tree | e047d48fd75fbcb0a58f50fdffc3359226710c7e /Source/cmFindBase.cxx | |
parent | d53e5dec3748e1d800dae595dcb78f2c4d55f788 (diff) | |
download | CMake-6706f84cd997d39026080e47e4944072add7f925.zip CMake-6706f84cd997d39026080e47e4944072add7f925.tar.gz CMake-6706f84cd997d39026080e47e4944072add7f925.tar.bz2 |
ENH: Refactor find_* command framework/appbundle search order impl.
- CMAKE_FIND_FRAMEWORK and CMAKE_FIND_APPBUNDLE are supposed to specify
whether to find frameworks/appbundles FIRST, LAST, ONLY, or NEVER.
- Previously this affected only the placement of CMAKE_FRAMEWORK_PATH
and CMAKE_APPBUNDLE_PATH with respect to the other path specifiers.
- Now it behaves as documented. The entire search path is inspected for
each kind of program, library, or header before trying the next kind.
- Additionally the ONLY mode is now honored for headers so that users
do not end up with a library in framework and a header from elsewhere.
Diffstat (limited to 'Source/cmFindBase.cxx')
-rw-r--r-- | Source/cmFindBase.cxx | 107 |
1 files changed, 35 insertions, 72 deletions
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 41e09f0..57cd110 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -282,31 +282,10 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn) void cmFindBase::ExpandPaths() { - // if NO Default paths was not specified add the - // standard search paths. - if(!this->NoDefaultPath) - { - if(this->SearchFrameworkFirst || this->SearchFrameworkOnly) - { - this->AddFrameworkPath(); - } - if(this->SearchAppBundleFirst || this->SearchAppBundleOnly) - { - this->AddAppBundlePath(); - } - this->AddCMakeEnvironmentPath(); - this->AddCMakeVariablePath(); - this->AddSystemEnvironmentPath(); - this->AddCMakeSystemVariablePath(); - if(this->SearchAppBundleLast) - { - this->AddAppBundlePath(); - } - if(this->SearchFrameworkLast) - { - this->AddFrameworkPath(); - } - } + this->AddCMakeEnvironmentPath(); + this->AddCMakeVariablePath(); + this->AddSystemEnvironmentPath(); + this->AddCMakeSystemVariablePath(); // Add paths specified by the caller. this->AddPathsInternal(this->UserPaths, CMakePath); @@ -381,49 +360,9 @@ void cmFindBase::AddEnvPrefixPath(const char* variable) } //---------------------------------------------------------------------------- -void cmFindBase::AddMacPath(const char* var, const char* sysvar) -{ - if(this->NoDefaultPath) - { - return; - } - - // first environment variables - if(!this->NoCMakeEnvironmentPath) - { - this->AddEnvPath(var); - } - - // add cmake variables - if(!this->NoCMakePath) - { - this->AddCMakePath(var); - } - - // add cmake system variables - if(!this->NoCMakeSystemPath) - { - this->AddCMakePath(sysvar); - } -} - -//---------------------------------------------------------------------------- -void cmFindBase::AddFrameworkPath() -{ - this->AddMacPath("CMAKE_FRAMEWORK_PATH", "CMAKE_SYSTEM_FRAMEWORK_PATH"); -} - -//---------------------------------------------------------------------------- -void cmFindBase::AddAppBundlePath() -{ - this->AddMacPath("CMAKE_APPBUNDLE_PATH", "CMAKE_SYSTEM_APPBUNDLE_PATH"); -} - -//---------------------------------------------------------------------------- void cmFindBase::AddCMakeEnvironmentPath() { - if(!this->NoCMakeEnvironmentPath && - !(this->SearchFrameworkOnly || this->SearchAppBundleOnly)) + if(!this->NoCMakeEnvironmentPath && !this->NoDefaultPath) { // Add CMAKE_*_PATH environment variables std::string var = "CMAKE_"; @@ -431,14 +370,22 @@ void cmFindBase::AddCMakeEnvironmentPath() var += "_PATH"; this->AddEnvPrefixPath("CMAKE_PREFIX_PATH"); this->AddEnvPath(var.c_str()); + + if(this->CMakePathName == "PROGRAM") + { + this->AddEnvPath("CMAKE_APPBUNDLE_PATH"); + } + else + { + this->AddEnvPath("CMAKE_FRAMEWORK_PATH"); + } } } //---------------------------------------------------------------------------- void cmFindBase::AddCMakeVariablePath() { - if(!this->NoCMakePath && - !(this->SearchFrameworkOnly || this->SearchAppBundleOnly)) + if(!this->NoCMakePath && !this->NoDefaultPath) { // Add CMake varibles of the same name as the previous environment // varibles CMAKE_*_PATH to be used most of the time with -D @@ -448,14 +395,22 @@ void cmFindBase::AddCMakeVariablePath() var += "_PATH"; this->AddCMakePrefixPath("CMAKE_PREFIX_PATH"); this->AddCMakePath(var.c_str()); + + if(this->CMakePathName == "PROGRAM") + { + this->AddCMakePath("CMAKE_APPBUNDLE_PATH"); + } + else + { + this->AddCMakePath("CMAKE_FRAMEWORK_PATH"); + } } } //---------------------------------------------------------------------------- void cmFindBase::AddSystemEnvironmentPath() { - if(!this->NoSystemEnvironmentPath && - !(this->SearchFrameworkOnly || this->SearchAppBundleOnly)) + if(!this->NoSystemEnvironmentPath && !this->NoDefaultPath) { // Add LIB or INCLUDE if(!this->EnvironmentPath.empty()) @@ -470,14 +425,22 @@ void cmFindBase::AddSystemEnvironmentPath() //---------------------------------------------------------------------------- void cmFindBase::AddCMakeSystemVariablePath() { - if(!this->NoCMakeSystemPath && - !(this->SearchFrameworkOnly || this->SearchAppBundleOnly)) + if(!this->NoCMakeSystemPath && !this->NoDefaultPath) { std::string var = "CMAKE_SYSTEM_"; var += this->CMakePathName; var += "_PATH"; this->AddCMakePrefixPath("CMAKE_SYSTEM_PREFIX_PATH"); this->AddCMakePath(var.c_str()); + + if(this->CMakePathName == "PROGRAM") + { + this->AddCMakePath("CMAKE_SYSTEM_APPBUNDLE_PATH"); + } + else + { + this->AddCMakePath("CMAKE_SYSTEM_FRAMEWORK_PATH"); + } } } |