summaryrefslogtreecommitdiffstats
path: root/Source/cmFindCommon.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-04-13 12:46:57 (GMT)
committerBrad King <brad.king@kitware.com>2013-11-19 17:39:39 (GMT)
commit7cd65c97fabd9f3249739a81dd1260a1e0b59ee1 (patch)
tree27ba5ee0d30c9a59ed288806ca1ce40060dd4f0f /Source/cmFindCommon.cxx
parent5096967ecd443f3d7477d823e7ffdffcc15a8ed1 (diff)
downloadCMake-7cd65c97fabd9f3249739a81dd1260a1e0b59ee1.zip
CMake-7cd65c97fabd9f3249739a81dd1260a1e0b59ee1.tar.gz
CMake-7cd65c97fabd9f3249739a81dd1260a1e0b59ee1.tar.bz2
Add CMAKE_SYSROOT variable to set --sysroot when cross compiling.
As CMAKE_ROOT_FIND_PATH can be a list, a new CMAKE_SYSROOT is introduced, which is never a list. The contents of this variable is passed to supporting compilers as --sysroot. It is also accounted for when processing implicit link directories reported by the compiler, and when generating RPATH information.
Diffstat (limited to 'Source/cmFindCommon.cxx')
-rw-r--r--Source/cmFindCommon.cxx15
1 files changed, 13 insertions, 2 deletions
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index 7beeda0..8c42811 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -138,16 +138,27 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths)
{
return;
}
+ const char* sysroot =
+ this->Makefile->GetDefinition("CMAKE_SYSROOT");
const char* rootPath =
this->Makefile->GetDefinition("CMAKE_FIND_ROOT_PATH");
- if((rootPath == 0) || (strlen(rootPath) == 0))
+ const bool noSysroot = !sysroot || !*sysroot;
+ const bool noRootPath = !rootPath || !*rootPath;
+ if(noSysroot && noRootPath)
{
return;
}
// Construct the list of path roots with no trailing slashes.
std::vector<std::string> roots;
- cmSystemTools::ExpandListArgument(rootPath, roots);
+ if (rootPath)
+ {
+ cmSystemTools::ExpandListArgument(rootPath, roots);
+ }
+ if (sysroot)
+ {
+ roots.push_back(sysroot);
+ }
for(std::vector<std::string>::iterator ri = roots.begin();
ri != roots.end(); ++ri)
{