GHS: Update selection of primaryTarget in MULTI project file

Changes to ``-A`` handling:
* Don't force CMAKE_GENERATOR_PLATFORM into cache when using default
  value (breaks using CMake presets).
* Don't print message when using default value (breaks CMake tests).

Changes to ``GHS_PRIMARY_TARGET`` handling:
* Add as a cache variable so its known to GUI
* Don't always include``GHS_TARGET_PLATFORM``, it's only needed if
  ``GHS_PRIMARY_TARGET`` wasn't set by the user.
* Set ``GHS_PRIMARY_TARGET`` during platform selection instead of when
  a language is enabled.  By performing this sooner
  ``GHS_TARGET_PLATFORM`` is not always required to be set into cache.
This commit is contained in:
Fred Baksik
2021-11-15 13:15:10 -05:00
parent bff48c5908
commit 831607889f
3 changed files with 40 additions and 45 deletions

View File

@@ -1,7 +1,21 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#Setup Green Hills MULTI specific compilation information
# Setup variables used for Green Hills MULTI generator
if(CMAKE_GENERATOR MATCHES "Green Hills MULTI")
# Set the project primaryTarget value
# If not set then primaryTarget will be determined by the generator
set(GHS_PRIMARY_TARGET "IGNORE" CACHE STRING "GHS MULTI primaryTarget")
mark_as_advanced(GHS_PRIMARY_TARGET)
if(NOT GHS_PRIMARY_TARGET)
# If project primaryTarget not set by user then set target platform name
# to be used by the generator when determining the primaryTarget.
set(GHS_TARGET_PLATFORM "integrity" CACHE STRING "GHS MULTI target platform")
mark_as_advanced(GHS_TARGET_PLATFORM)
endif()
endif()
if(CMAKE_HOST_UNIX)
set(GHS_OS_ROOT "/usr/ghs" CACHE PATH "GHS platform OS search root directory")
@@ -30,7 +44,7 @@ if(NOT GHS_OS_DIR)
endif ()
#filter based on platform name
if(GHS_TARGET_PLATFORM MATCHES "integrity")
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)
@@ -50,6 +64,7 @@ endif()
set(GHS_BSP_NAME "IGNORE" CACHE STRING "BSP name")
# Setup MULTI project variables
set(GHS_CUSTOMIZATION "" CACHE FILEPATH "optional GHS customization")
mark_as_advanced(GHS_CUSTOMIZATION)
set(GHS_GPJ_MACROS "" CACHE STRING "optional GHS macros generated in the .gpjs for legacy reasons")