FetchContent: Pass GHS Variables to subbuild

Fixes: #24244
This commit is contained in:
William Sciaroni
2023-10-30 12:24:16 -05:00
committed by Craig Scott
parent 8e77c6e8ae
commit 6a81104413
2 changed files with 17 additions and 0 deletions

View File

@@ -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

View File

@@ -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.