diff options
author | Chuck Atkins <chuck.atkins@kitware.com> | 2014-10-17 17:07:26 (GMT) |
---|---|---|
committer | Chuck Atkins <chuck.atkins@kitware.com> | 2014-11-12 13:21:46 (GMT) |
commit | 1abd7cd930022ba045c3c0cd34406cbe19db84d3 (patch) | |
tree | 9514de06c2c7c9a072991560597139357510063d /Source/cmFindBase.cxx | |
parent | 2a9ac4bd83f7247539616545ef0772fea1f4a1fc (diff) | |
download | CMake-1abd7cd930022ba045c3c0cd34406cbe19db84d3.zip CMake-1abd7cd930022ba045c3c0cd34406cbe19db84d3.tar.gz CMake-1abd7cd930022ba045c3c0cd34406cbe19db84d3.tar.bz2 |
Use containers of labeled search paths instead of individual members
Manage classes of search paths in labeled containers. This removes the
need to have a seperate member variable for each type of search path, but
also allows path types to be grouped togethor in various different ways
and manipulated as subsets of the full set of search paths.
Diffstat (limited to 'Source/cmFindBase.cxx')
-rw-r--r-- | Source/cmFindBase.cxx | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 52f04ad..beb6dde 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -225,102 +225,112 @@ void cmFindBase::ExpandPaths() //---------------------------------------------------------------------------- void cmFindBase::FillCMakeEnvironmentPath() { + cmSearchPath &paths = this->LabeledPaths[PathLabel::CMakeEnvironment]; + // Add CMAKE_*_PATH environment variables std::string var = "CMAKE_"; var += this->CMakePathName; var += "_PATH"; - this->CMakeEnvironmentPaths.AddEnvPrefixPath("CMAKE_PREFIX_PATH"); - this->CMakeEnvironmentPaths.AddEnvPath(var); + paths.AddEnvPrefixPath("CMAKE_PREFIX_PATH"); + paths.AddEnvPath(var); if(this->CMakePathName == "PROGRAM") { - this->CMakeEnvironmentPaths.AddEnvPath("CMAKE_APPBUNDLE_PATH"); + paths.AddEnvPath("CMAKE_APPBUNDLE_PATH"); } else { - this->CMakeEnvironmentPaths.AddEnvPath("CMAKE_FRAMEWORK_PATH"); + paths.AddEnvPath("CMAKE_FRAMEWORK_PATH"); } - this->CMakeEnvironmentPaths.AddSuffixes(this->SearchPathSuffixes); + paths.AddSuffixes(this->SearchPathSuffixes); } //---------------------------------------------------------------------------- void cmFindBase::FillCMakeVariablePath() { + cmSearchPath &paths = this->LabeledPaths[PathLabel::CMake]; + // Add CMake varibles of the same name as the previous environment // varibles CMAKE_*_PATH to be used most of the time with -D // command line options std::string var = "CMAKE_"; var += this->CMakePathName; var += "_PATH"; - this->CMakeVariablePaths.AddCMakePrefixPath("CMAKE_PREFIX_PATH"); - this->CMakeVariablePaths.AddCMakePath(var); + paths.AddCMakePrefixPath("CMAKE_PREFIX_PATH"); + paths.AddCMakePath(var); if(this->CMakePathName == "PROGRAM") { - this->CMakeVariablePaths.AddCMakePath("CMAKE_APPBUNDLE_PATH"); + paths.AddCMakePath("CMAKE_APPBUNDLE_PATH"); } else { - this->CMakeVariablePaths.AddCMakePath("CMAKE_FRAMEWORK_PATH"); + paths.AddCMakePath("CMAKE_FRAMEWORK_PATH"); } - this->CMakeVariablePaths.AddSuffixes(this->SearchPathSuffixes); + paths.AddSuffixes(this->SearchPathSuffixes); } //---------------------------------------------------------------------------- void cmFindBase::FillSystemEnvironmentPath() { + cmSearchPath &paths = this->LabeledPaths[PathLabel::SystemEnvironment]; + // Add LIB or INCLUDE if(!this->EnvironmentPath.empty()) { - this->SystemEnvironmentPaths.AddEnvPath(this->EnvironmentPath); + paths.AddEnvPath(this->EnvironmentPath); } // Add PATH - this->SystemEnvironmentPaths.AddEnvPath("PATH"); - this->SystemEnvironmentPaths.AddSuffixes(this->SearchPathSuffixes); + paths.AddEnvPath("PATH"); + paths.AddSuffixes(this->SearchPathSuffixes); } //---------------------------------------------------------------------------- void cmFindBase::FillCMakeSystemVariablePath() { + cmSearchPath &paths = this->LabeledPaths[PathLabel::CMakeSystem]; + std::string var = "CMAKE_SYSTEM_"; var += this->CMakePathName; var += "_PATH"; - this->CMakeSystemVariablePaths.AddCMakePrefixPath( - "CMAKE_SYSTEM_PREFIX_PATH"); - this->CMakeSystemVariablePaths.AddCMakePath(var); + paths.AddCMakePrefixPath("CMAKE_SYSTEM_PREFIX_PATH"); + paths.AddCMakePath(var); if(this->CMakePathName == "PROGRAM") { - this->CMakeSystemVariablePaths.AddCMakePath( - "CMAKE_SYSTEM_APPBUNDLE_PATH"); + paths.AddCMakePath("CMAKE_SYSTEM_APPBUNDLE_PATH"); } else { - this->CMakeSystemVariablePaths.AddCMakePath("CMAKE_SYSTEM_FRAMEWORK_PATH"); + paths.AddCMakePath("CMAKE_SYSTEM_FRAMEWORK_PATH"); } - this->CMakeSystemVariablePaths.AddSuffixes(this->SearchPathSuffixes); + paths.AddSuffixes(this->SearchPathSuffixes); } //---------------------------------------------------------------------------- void cmFindBase::FillUserHintsPath() { + cmSearchPath &paths = this->LabeledPaths[PathLabel::Hints]; + for(std::vector<std::string>::const_iterator p = this->UserHintsArgs.begin(); p != this->UserHintsArgs.end(); ++p) { - this->UserHintsPaths.AddUserPath(*p); + paths.AddUserPath(*p); } - this->UserHintsPaths.AddSuffixes(this->SearchPathSuffixes); + paths.AddSuffixes(this->SearchPathSuffixes); } //---------------------------------------------------------------------------- void cmFindBase::FillUserGuessPath() { + cmSearchPath &paths = this->LabeledPaths[PathLabel::Guess]; + for(std::vector<std::string>::const_iterator p = this->UserGuessArgs.begin(); p != this->UserGuessArgs.end(); ++p) { - this->UserGuessPaths.AddUserPath(*p); + paths.AddUserPath(*p); } - this->UserGuessPaths.AddSuffixes(this->SearchPathSuffixes); + paths.AddSuffixes(this->SearchPathSuffixes); } //---------------------------------------------------------------------------- |