summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Sciaroni <William.Sciaroni@ngc.com>2023-10-30 17:24:16 (GMT)
committerCraig Scott <craig.scott@crascit.com>2023-11-04 21:42:27 (GMT)
commit6a811044130624b32dcedb4c7a1142c3f7ad17f5 (patch)
tree3996211c99c9c691c442b124f6be7a5a041e5280
parent8e77c6e8ae497632fd39c4b3da1965215eb6a568 (diff)
downloadCMake-6a811044130624b32dcedb4c7a1142c3f7ad17f5.zip
CMake-6a811044130624b32dcedb4c7a1142c3f7ad17f5.tar.gz
CMake-6a811044130624b32dcedb4c7a1142c3f7ad17f5.tar.bz2
FetchContent: Pass GHS Variables to subbuild
Fixes: #24244
-rw-r--r--Modules/ExternalProject.cmake3
-rw-r--r--Modules/FetchContent.cmake14
2 files changed, 17 insertions, 0 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 67b805b..801a8de 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -3778,6 +3778,9 @@ function(_ep_extract_configure_command var name)
list(APPEND cmd "-G${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}")
else()
list(APPEND cmd "-G${CMAKE_GENERATOR}")
+ # GreenHills needs to know about the compiler and toolset.
+ # Be sure to update the similar section in
+ # FetchContent.cmake:__FetchContent_directPopulate()
if("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
set(has_cmake_cache_default_args 1)
list(APPEND cmake_cache_default_args
diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake
index f10684c..ad5a6f1 100644
--- a/Modules/FetchContent.cmake
+++ b/Modules/FetchContent.cmake
@@ -1596,6 +1596,20 @@ ExternalProject_Add_Step(${contentName}-populate copyfile
list(APPEND subCMakeOpts "-DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM}")
endif()
+ # GreenHills needs to know about the compiler and toolset to run the
+ # subbuild commands. Be sure to update the similar section in
+ # ExternalProject.cmake:_ep_extract_configure_command()
+ if(CMAKE_GENERATOR MATCHES "Green Hills MULTI")
+ list(APPEND subCMakeOpts
+ "-DGHS_TARGET_PLATFORM:STRING=${GHS_TARGET_PLATFORM}"
+ "-DGHS_PRIMARY_TARGET:STRING=${GHS_PRIMARY_TARGET}"
+ "-DGHS_TOOLSET_ROOT:STRING=${GHS_TOOLSET_ROOT}"
+ "-DGHS_OS_ROOT:STRING=${GHS_OS_ROOT}"
+ "-DGHS_OS_DIR:STRING=${GHS_OS_DIR}"
+ "-DGHS_BSP_NAME:STRING=${GHS_BSP_NAME}"
+ )
+ endif()
+
# Override the sub-build's configuration types for multi-config generators.
# This ensures we are not affected by any custom setting from the project
# and can always request a known configuration further below.