summaryrefslogtreecommitdiff
path: root/Source/cmCoreTryCompile.cxx
diff options
context:
space:
mode:
authorFred Baksik <frodak17@gmail.com>2019-01-08 23:52:12 -0500
committerFred Baksik <frodak17@gmail.com>2019-01-16 10:42:00 -0500
commit436cc5e991c7be07610d7902a5ce2a00221ca0a2 (patch)
tree912fdd8810121d1bc39520340b999c6c7c9ed7c0 /Source/cmCoreTryCompile.cxx
parent4a1ec0de3d2102918284eff13763f2aa3d20d119 (diff)
downloadcmake-436cc5e991c7be07610d7902a5ce2a00221ca0a2.tar.gz
GHS: try_compile() now uses GHS platform variables
-- Forward GHS platform variables to try_compile() CMAKE_TRY_COMPILE_PLATFORM_VARIABLES only worked for source signature try_compile() -- Update tests to no longer add GHS platform variables to try_compile() -- Avoid linker error in GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt by building library
Diffstat (limited to 'Source/cmCoreTryCompile.cxx')
-rw-r--r--Source/cmCoreTryCompile.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index a483fd17d6..137b25f50c 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -57,6 +57,12 @@ static std::string const kCMAKE_TRY_COMPILE_PLATFORM_VARIABLES =
"CMAKE_TRY_COMPILE_PLATFORM_VARIABLES";
static std::string const kCMAKE_WARN_DEPRECATED = "CMAKE_WARN_DEPRECATED";
+/* GHS Multi platform variables */
+static std::set<std::string> ghs_platform_vars{
+ "GHS_TARGET_PLATFORM", "GHS_PRIMARY_TARGET", "GHS_TOOLSET_ROOT",
+ "GHS_OS_ROOT", "GHS_OS_DIR", "GHS_BSP_NAME"
+};
+
static void writeProperty(FILE* fout, std::string const& targetName,
std::string const& prop, std::string const& value)
{
@@ -869,6 +875,16 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
projectName = "CMAKE_TRY_COMPILE";
}
+ if (this->Makefile->GetState()->UseGhsMultiIDE()) {
+ // Forward the GHS variables to the inner project cache.
+ for (std::string const& var : ghs_platform_vars) {
+ if (const char* val = this->Makefile->GetDefinition(var)) {
+ std::string flag = "-D" + var + "=" + val;
+ cmakeFlags.push_back(std::move(flag));
+ }
+ }
+ }
+
bool erroroc = cmSystemTools::GetErrorOccuredFlag();
cmSystemTools::ResetErrorOccuredFlag();
std::string output;