summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Baksik <fdk17@ftml.net>2021-11-15 18:15:11 (GMT)
committerFred Baksik <fdk17@ftml.net>2021-11-15 18:15:11 (GMT)
commit0427f225395d3fbc5df273596cb7b9d150a369b7 (patch)
tree5879329bb2df7a1219df69a8ee527e494b4f2ec0
parente006b87cc635f847eebad567159d17db191dc1f0 (diff)
downloadCMake-0427f225395d3fbc5df273596cb7b9d150a369b7.zip
CMake-0427f225395d3fbc5df273596cb7b9d150a369b7.tar.gz
CMake-0427f225395d3fbc5df273596cb7b9d150a369b7.tar.bz2
GHS: Update RTOS selection logic
Selection of an RTOS only needs to be performed if not set by user. Avoid CMake developer warnings for setting GHS_OS_DIR multiple times. Instead only set it once after searching has been performed. Remove all the logic for printing error and status messages about RTOS selection. This was broken and reporting incorrect messages. These messages also breaks CMake tests. NOTE: If RTOS selection fails then the compiler checks will result in a build error. The build error will report that the RTOS "GHS_OS_DIR-NOT-SPECIFIED" does not exist.
-rw-r--r--Modules/Platform/GHS-MULTI-Determine.cmake43
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx30
-rw-r--r--Source/cmGlobalGhsMultiGenerator.h1
3 files changed, 27 insertions, 47 deletions
diff --git a/Modules/Platform/GHS-MULTI-Determine.cmake b/Modules/Platform/GHS-MULTI-Determine.cmake
index 0a6a3b1..ba1bebb 100644
--- a/Modules/Platform/GHS-MULTI-Determine.cmake
+++ b/Modules/Platform/GHS-MULTI-Determine.cmake
@@ -33,24 +33,27 @@ if(CMAKE_GENERATOR MATCHES "Green Hills MULTI")
mark_as_advanced(GHS_GPJ_MACROS)
endif()
+# Settings for OS selection
if(CMAKE_HOST_UNIX)
- set(GHS_OS_ROOT "/usr/ghs" CACHE PATH "GHS platform OS search root directory")
+ set(_os_root "/usr/ghs")
else()
- set(GHS_OS_ROOT "C:/ghs" CACHE PATH "GHS platform OS search root directory")
+ set(_os_root "C:/ghs")
endif()
+set(GHS_OS_ROOT "${_os_root}" CACHE PATH "GHS platform OS search root directory")
+unset(_os_root)
mark_as_advanced(GHS_OS_ROOT)
-set(GHS_OS_DIR "NOTFOUND" CACHE PATH "GHS platform OS directory")
-mark_as_advanced(GHS_OS_DIR)
-
-set(GHS_OS_DIR_OPTION "-os_dir " CACHE STRING "GHS compiler OS option")
-mark_as_advanced(GHS_OS_DIR_OPTION)
-
-#set GHS_OS_DIR if not set by user
-if(NOT GHS_OS_DIR)
+# Search for GHS_OS_DIR if not set by user and is known to be required
+if(GHS_PRIMARY_TARGET MATCHES "integrity" OR GHS_TARGET_PLATFORM MATCHES "integrity")
+ # Use a value that will make it apparent RTOS selection failed
+ set(_ghs_os_dir "GHS_OS_DIR-NOT-SPECIFIED")
+else()
+ set(_ghs_os_dir "IGNORE")
+endif()
+if(_ghs_os_dir AND NOT DEFINED GHS_OS_DIR)
if(EXISTS ${GHS_OS_ROOT})
- #get all directories in root directory
+ # Get all directories in root directory
FILE(GLOB GHS_CANDIDATE_OS_DIRS
LIST_DIRECTORIES true RELATIVE ${GHS_OS_ROOT} ${GHS_OS_ROOT}/*)
FILE(GLOB GHS_CANDIDATE_OS_FILES
@@ -59,23 +62,25 @@ if(NOT GHS_OS_DIR)
list(REMOVE_ITEM GHS_CANDIDATE_OS_DIRS ${GHS_CANDIDATE_OS_FILES})
endif ()
- #filter based on platform name
+ # Filter based on platform name
if(GHS_PRIMARY_TARGET MATCHES "integrity" OR GHS_TARGET_PLATFORM MATCHES "integrity")
list(FILTER GHS_CANDIDATE_OS_DIRS INCLUDE REGEX "int[0-9][0-9][0-9][0-9a-z]")
- else() #fall-back for standalone
- unset(GHS_CANDIDATE_OS_DIRS)
- set(GHS_OS_DIR "IGNORE")
endif()
+ # Select latest? of matching candidates
if(GHS_CANDIDATE_OS_DIRS)
list(SORT GHS_CANDIDATE_OS_DIRS)
list(GET GHS_CANDIDATE_OS_DIRS -1 GHS_OS_DIR)
- string(CONCAT GHS_OS_DIR ${GHS_OS_ROOT} "/" ${GHS_OS_DIR})
+ string(CONCAT _ghs_os_dir ${GHS_OS_ROOT} "/" ${GHS_OS_DIR})
endif()
-
- #update cache with new value
- set(GHS_OS_DIR "${GHS_OS_DIR}" CACHE PATH "GHS platform OS directory" FORCE)
endif()
endif()
+#Used for targets requiring RTOS
+set(GHS_OS_DIR "${_ghs_os_dir}" CACHE PATH "GHS platform OS directory")
+mark_as_advanced(GHS_OS_DIR)
+
+set(GHS_OS_DIR_OPTION "-os_dir " CACHE STRING "GHS compiler OS option")
+mark_as_advanced(GHS_OS_DIR_OPTION)
+
set(GHS_BSP_NAME "IGNORE" CACHE STRING "BSP name")
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 0727f67..e319242 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -133,27 +133,6 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p,
cmStateEnums::STRING, true);
}
- /* 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 (cmIsOff(osdir) && platform.find("integrity") != std::string::npos) {
- if (!this->CMakeInstance->GetIsInTryCompile()) {
- /* required OS location is not found */
- std::string m = cmStrCat(
- "Green Hills MULTI: GHS_OS_DIR not specified; No OS found in \"",
- mf->GetSafeDefinition("GHS_OS_ROOT"), '"');
- cmSystemTools::Message(m);
- }
- osdir = "GHS_OS_DIR-NOT-SPECIFIED";
- } else if (!this->CMakeInstance->GetIsInTryCompile() &&
- cmIsOff(this->OsDir) && !cmIsOff(osdir)) {
- /* OS location was updated by auto-selection */
- std::string m = cmStrCat(
- "Green Hills MULTI: GHS_OS_DIR not specified; found \"", osdir, '"');
- cmSystemTools::Message(m);
- }
- this->OsDir = osdir;
-
// Determine GHS_BSP_NAME
std::string bspName = mf->GetSafeDefinition("GHS_BSP_NAME");
@@ -180,9 +159,6 @@ void cmGlobalGhsMultiGenerator::EnableLanguage(
mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files
- /* store original OS location */
- this->OsDir = mf->GetSafeDefinition("GHS_OS_DIR");
-
this->cmGlobalGenerator::EnableLanguage(l, mf, optional);
}
@@ -340,17 +316,17 @@ void cmGlobalGhsMultiGenerator::WriteTopLevelProject(std::ostream& fout,
// Specify OS DIR if supplied by user
// -- not all platforms require this entry in the project file
- if (!cmIsOff(this->OsDir)) {
+ cmValue osDir = this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR");
+ if (!cmIsOff(osDir)) {
cmValue osDirOption =
this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR_OPTION");
- std::replace(this->OsDir.begin(), this->OsDir.end(), '\\', '/');
fout << " ";
if (cmIsOff(osDirOption)) {
fout << "";
} else {
fout << *osDirOption;
}
- fout << "\"" << this->OsDir << "\"\n";
+ fout << "\"" << osDir << "\"\n";
}
}
diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h
index 935a878..9076e0e 100644
--- a/Source/cmGlobalGhsMultiGenerator.h
+++ b/Source/cmGlobalGhsMultiGenerator.h
@@ -112,7 +112,6 @@ private:
static std::string TrimQuotes(std::string str);
- std::string OsDir;
static const char* DEFAULT_BUILD_PROGRAM;
bool ComputeTargetBuildOrder(cmGeneratorTarget const* tgt,