diff options
author | Brad King <brad.king@kitware.com> | 2006-01-27 23:20:55 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-01-27 23:20:55 (GMT) |
commit | 938890757aa721ec08909df4870304d5a9405337 (patch) | |
tree | f1120377ca512d92ffb1aad64e5bb59e0d5c699b /Source/cmMakefile.cxx | |
parent | f4b306d5d449b8b5959c2d32898bd9fd23b893c6 (diff) | |
download | CMake-938890757aa721ec08909df4870304d5a9405337.zip CMake-938890757aa721ec08909df4870304d5a9405337.tar.gz CMake-938890757aa721ec08909df4870304d5a9405337.tar.bz2 |
ENH: Improved support for user-configured search paths. Paths given in the CMAKE_LIBRARY_PATH cmake variable are searched first, then those in the CMAKE_LIBRARY_PATH environment variable, then those listed in the call to the FIND_LIBRARY command and finally those listed in the PATH environment variable. The support is similar for finding include files with FIND_PATH, but the variable is CMAKE_INCLUDE_PATH.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 55 |
1 files changed, 49 insertions, 6 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 58dbab1..7d38acc 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2195,18 +2195,17 @@ std::string cmMakefile::FindLibrary(const char* name, { return cmSystemTools::CollapseFullPath(name); } - // Add the system search path to our path. + + // Construct a search path. std::vector<std::string> path; - cmSystemTools::GetPath(path, "CMAKE_LIBRARY_PATH"); - cmSystemTools::GetPath(path, "LIB"); - cmSystemTools::GetPath(path); + this->GetLibrarySearchPath(userPaths, path); + bool supportFrameworks = false; if(this->GetDefinition("APPLE")) { supportFrameworks = true; } - // now add the path - path.insert(path.end(), userPaths.begin(), userPaths.end()); + // Add some lib directories specific to compilers, depending on the // current generator, so that library that might have been stored here // can be found too. @@ -2309,6 +2308,50 @@ std::string cmMakefile::FindLibrary(const char* name, return tmp; } +//---------------------------------------------------------------------------- +void +cmMakefile::GetIncludeSearchPath(const std::vector<std::string>& callerPaths, + std::vector<std::string>& path) +{ + // Add paths configured into the cache for this project. + if(const char* cmakeIncludePath = this->GetDefinition("CMAKE_INCLUDE_PATH")) + { + cmSystemTools::ExpandListArgument(cmakeIncludePath, path); + } + + // Add paths in the user's environment. + cmSystemTools::GetPath(path, "CMAKE_INCLUDE_PATH"); + cmSystemTools::GetPath(path, "INCLUDE"); + + // Add paths given by the caller. + path.insert(path.end(), callerPaths.begin(), callerPaths.end()); + + // Add standard system paths. + cmSystemTools::GetPath(path); +} + +//---------------------------------------------------------------------------- +void +cmMakefile::GetLibrarySearchPath(const std::vector<std::string>& callerPaths, + std::vector<std::string>& path) +{ + // Add paths configured into the cache for this project. + if(const char* cmakeLibPath = this->GetDefinition("CMAKE_LIBRARY_PATH")) + { + cmSystemTools::ExpandListArgument(cmakeLibPath, path); + } + + // Add paths in the user's environment. + cmSystemTools::GetPath(path, "CMAKE_LIBRARY_PATH"); + cmSystemTools::GetPath(path, "LIB"); + + // Add paths given by the caller. + path.insert(path.end(), callerPaths.begin(), callerPaths.end()); + + // Add standard system paths. + cmSystemTools::GetPath(path); +} + std::string cmMakefile::GetModulesFile(const char* filename) { std::vector<std::string> modulePath; |