diff options
Diffstat (limited to 'Source/cmCoreTryCompile.cxx')
-rw-r--r-- | Source/cmCoreTryCompile.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 541ae76..f9b494e 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -24,10 +24,18 @@ static std::string const kCMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN = "CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN"; static std::string const kCMAKE_C_COMPILER_TARGET = "CMAKE_C_COMPILER_TARGET"; +static std::string const kCMAKE_C_LINK_NO_PIE_SUPPORTED = + "CMAKE_C_LINK_NO_PIE_SUPPORTED"; +static std::string const kCMAKE_C_LINK_PIE_SUPPORTED = + "CMAKE_C_LINK_PIE_SUPPORTED"; static std::string const kCMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN = "CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN"; static std::string const kCMAKE_CXX_COMPILER_TARGET = "CMAKE_CXX_COMPILER_TARGET"; +static std::string const kCMAKE_CXX_LINK_NO_PIE_SUPPORTED = + "CMAKE_CXX_LINK_NO_PIE_SUPPORTED"; +static std::string const kCMAKE_CXX_LINK_PIE_SUPPORTED = + "CMAKE_CXX_LINK_PIE_SUPPORTED"; static std::string const kCMAKE_ENABLE_EXPORTS = "CMAKE_ENABLE_EXPORTS"; static std::string const kCMAKE_LINK_SEARCH_END_STATIC = "CMAKE_LINK_SEARCH_END_STATIC"; @@ -633,6 +641,16 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, vars.insert(varList.begin(), varList.end()); } + if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0083) == + cmPolicies::NEW) { + // To ensure full support of PIE, propagate cache variables + // driving the link options + vars.insert(kCMAKE_C_LINK_PIE_SUPPORTED); + vars.insert(kCMAKE_C_LINK_NO_PIE_SUPPORTED); + vars.insert(kCMAKE_CXX_LINK_PIE_SUPPORTED); + vars.insert(kCMAKE_CXX_LINK_NO_PIE_SUPPORTED); + } + /* for the TRY_COMPILEs we want to be able to specify the architecture. So the user can set CMAKE_OSX_ARCHITECTURES to i386;ppc and then set CMAKE_TRY_COMPILE_OSX_ARCHITECTURES first to i386 and then to ppc to |