diff options
author | Fred Baksik <frodak17@gmail.com> | 2019-03-20 00:56:30 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-03-29 16:38:12 (GMT) |
commit | 266dadf8683c9c0081368604c4ccae12e8ffc9f7 (patch) | |
tree | 8f31f9da6d5ea106b09367c34c178462f47ef330 /Source/cmGlobalGhsMultiGenerator.cxx | |
parent | 89abbdd8c8db5bf587373f2a00f6a816eddd8496 (diff) | |
download | CMake-266dadf8683c9c0081368604c4ccae12e8ffc9f7.zip CMake-266dadf8683c9c0081368604c4ccae12e8ffc9f7.tar.gz CMake-266dadf8683c9c0081368604c4ccae12e8ffc9f7.tar.bz2 |
GHS: Print status message regarding GHS_OS_DIR
-- Rename platform script so it runs before initial try_compile() in
project() command.
-- Fix incorrect variable name GHS_OS_DIR_OPTION
-- Remove unnecessary ".*" from REGEX expression for GHS_CANDIDATE_OS_DIRS
-- Forward GHS_OS_DIR_OPTION to try_compile() and preserve trailing
whitespace of the variable.
Diffstat (limited to 'Source/cmGlobalGhsMultiGenerator.cxx')
-rw-r--r-- | Source/cmGlobalGhsMultiGenerator.cxx | 75 |
1 files changed, 49 insertions, 26 deletions
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index e6a1d78..4379b34 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -132,17 +132,30 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p, cmStateEnums::INTERNAL); } - const char* tgtPlatform = mf->GetDefinition("GHS_TARGET_PLATFORM"); - if (tgtPlatform == nullptr) { - cmSystemTools::Message("Green Hills MULTI: GHS_TARGET_PLATFORM not " - "specified; defaulting to \"integrity\""); - tgtPlatform = "integrity"; + /* check if OS location has been updated by platform scripts */ + std::string platform = mf->GetSafeDefinition("GHS_TARGET_PLATFORM"); + std::string osdir = mf->GetSafeDefinition("GHS_OS_DIR"); + if (cmSystemTools::IsOff(osdir.c_str()) && + platform.find("integrity") != std::string::npos) { + if (!this->CMakeInstance->GetIsInTryCompile()) { + /* required OS location is not found */ + std::string m = + "Green Hills MULTI: GHS_OS_DIR not specified; No OS found in \""; + m += mf->GetSafeDefinition("GHS_OS_ROOT"); + m += "\""; + cmSystemTools::Message(m); + } + osdir = "GHS_OS_DIR-NOT-SPECIFIED"; + } else if (!this->CMakeInstance->GetIsInTryCompile() && + cmSystemTools::IsOff(this->OsDir) && + !cmSystemTools::IsOff(osdir)) { + /* OS location was updated by auto-selection */ + std::string m = "Green Hills MULTI: GHS_OS_DIR not specified; found \""; + m += osdir; + m += "\""; + cmSystemTools::Message(m); } - - /* store the platform name for later use */ - mf->AddCacheDefinition("GHS_TARGET_PLATFORM", tgtPlatform, - "Name of GHS target platform.", - cmStateEnums::INTERNAL); + this->OsDir = osdir; return true; } @@ -153,6 +166,21 @@ void cmGlobalGhsMultiGenerator::EnableLanguage( mf->AddDefinition("CMAKE_SYSTEM_NAME", "GHS-MULTI"); mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files + + const char* tgtPlatform = mf->GetDefinition("GHS_TARGET_PLATFORM"); + if (!tgtPlatform) { + cmSystemTools::Message("Green Hills MULTI: GHS_TARGET_PLATFORM not " + "specified; defaulting to \"integrity\""); + tgtPlatform = "integrity"; + } + + /* store the platform name for later use */ + mf->AddCacheDefinition("GHS_TARGET_PLATFORM", tgtPlatform, + "Name of GHS target platform.", cmStateEnums::STRING); + + /* store original OS location */ + this->OsDir = mf->GetSafeDefinition("GHS_OS_DIR"); + this->cmGlobalGenerator::EnableLanguage(l, mf, optional); } @@ -261,22 +289,17 @@ void cmGlobalGhsMultiGenerator::WriteTopLevelProject( // Specify OS DIR if supplied by user // -- not all platforms require this entry in the project file - std::string osDir; - std::string osDirOption; - if (char const* osDirCache = - this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR")) { - osDir = osDirCache; - } - - if (char const* osDirOptionCache = - this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR_OPTION")) { - osDirOption = osDirOptionCache; - } - - if (!cmSystemTools::IsOff(osDir.c_str()) || - platform.find("integrity") != std::string::npos) { - std::replace(osDir.begin(), osDir.end(), '\\', '/'); - fout << " " << osDirOption << "\"" << osDir << "\"" << std::endl; + if (!cmSystemTools::IsOff(this->OsDir.c_str())) { + const char* osDirOption = + this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR_OPTION"); + std::replace(this->OsDir.begin(), this->OsDir.end(), '\\', '/'); + fout << " "; + if (cmSystemTools::IsOff(osDirOption)) { + fout << ""; + } else { + fout << osDirOption; + } + fout << "\"" << this->OsDir << "\"" << std::endl; } WriteSubProjects(fout, root, generators); |