diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-04-13 12:46:57 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-06-07 11:32:52 (GMT) |
commit | de4da665d3205afa239749c41513a315c3831f51 (patch) | |
tree | 02ab204c77efc1a89b620b38c118913c06c125f8 /Source/cmNinjaNormalTargetGenerator.cxx | |
parent | bb879bcf2dd8a65eeb285ef67aa72c16aab01938 (diff) | |
download | CMake-de4da665d3205afa239749c41513a315c3831f51.zip CMake-de4da665d3205afa239749c41513a315c3831f51.tar.gz CMake-de4da665d3205afa239749c41513a315c3831f51.tar.bz2 |
Use --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/cmNinjaNormalTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 1bc4302..0a2a75f 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -223,7 +223,27 @@ cmNinjaNormalTargetGenerator vars.TargetVersionMajor = targetVersionMajor.c_str(); vars.TargetVersionMinor = targetVersionMinor.c_str(); - vars.Flags = "$FLAGS"; + + std::string flags = "$FLAGS"; + + if (const char *rootPath = + this->GetMakefile()->GetSafeDefinition("CMAKE_SYSROOT")) + { + if (*rootPath) + { + if (const char *sysrootFlag = + this->GetMakefile()->GetDefinition("CMAKE_SYSROOT_FLAG")) + { + flags += " "; + flags += sysrootFlag; + flags += this->GetLocalGenerator()->EscapeForShell(rootPath); + flags += " "; + } + } + } + + vars.Flags = flags.c_str(); + vars.LinkFlags = "$LINK_FLAGS"; std::string langFlags; |