diff options
author | Fred Baksik <frodak17@gmail.com> | 2019-01-09 04:52:12 (GMT) |
---|---|---|
committer | Fred Baksik <frodak17@gmail.com> | 2019-01-16 15:42:00 (GMT) |
commit | 436cc5e991c7be07610d7902a5ce2a00221ca0a2 (patch) | |
tree | 912fdd8810121d1bc39520340b999c6c7c9ed7c0 /Source/cmCoreTryCompile.cxx | |
parent | 4a1ec0de3d2102918284eff13763f2aa3d20d119 (diff) | |
download | CMake-436cc5e991c7be07610d7902a5ce2a00221ca0a2.zip CMake-436cc5e991c7be07610d7902a5ce2a00221ca0a2.tar.gz CMake-436cc5e991c7be07610d7902a5ce2a00221ca0a2.tar.bz2 |
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.cxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index a483fd1..137b25f 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; |