Browse Source

Merge topic 'FetchContent-GHS'

6a81104413 FetchContent: Pass GHS Variables to subbuild

Acked-by: Kitware Robot <[email protected]>
Merge-request: !8930
Craig Scott 2 years ago
parent
commit
768690ee9a
2 changed files with 17 additions and 0 deletions
  1. 3 0
      Modules/ExternalProject.cmake
  2. 14 0
      Modules/FetchContent.cmake

+ 3 - 0
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

+ 14 - 0
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.