diff options
author | Fred Baksik <fdk17@ftml.net> | 2021-11-15 18:15:11 (GMT) |
---|---|---|
committer | Fred Baksik <fdk17@ftml.net> | 2021-11-15 18:15:11 (GMT) |
commit | 0427f225395d3fbc5df273596cb7b9d150a369b7 (patch) | |
tree | 5879329bb2df7a1219df69a8ee527e494b4f2ec0 /Modules | |
parent | e006b87cc635f847eebad567159d17db191dc1f0 (diff) | |
download | CMake-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.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/Platform/GHS-MULTI-Determine.cmake | 43 |
1 files changed, 24 insertions, 19 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") |