summaryrefslogtreecommitdiffstats
path: root/Modules/ExternalProject.cmake
diff options
context:
space:
mode:
authorFred Baksik <frodak17@gmail.com>2019-04-08 13:55:35 (GMT)
committerFred Baksik <frodak17@gmail.com>2019-04-11 17:15:51 (GMT)
commit3b415c60c1a02b9ac76089a44c28e70692dcdef1 (patch)
treecdfb9a96bb27861a70dc1c759bc3b33b577b2120 /Modules/ExternalProject.cmake
parent83c47ef5b8a6b1a63edbd82092d8eae68da453d6 (diff)
downloadCMake-3b415c60c1a02b9ac76089a44c28e70692dcdef1.zip
CMake-3b415c60c1a02b9ac76089a44c28e70692dcdef1.tar.gz
CMake-3b415c60c1a02b9ac76089a44c28e70692dcdef1.tar.bz2
GHS: Update ExternalProject for GHS tools
-- When using default values for the external project forward GHS platform variables so that the external project builds with the same tools as the original project. -- Fix issue with bad top level project when GHS_PRIMARY_TARGET is set but has no value. In this case treat it as unset and use default value.
Diffstat (limited to 'Modules/ExternalProject.cmake')
-rw-r--r--Modules/ExternalProject.cmake38
1 files changed, 26 insertions, 12 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 948b921..104ef9f 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -421,6 +421,10 @@ External Project Definition
different behavior depending on whether the build starts from a fresh
build directory or re-uses previous build contents.
+ If the CMake generator is the ``Green Hills MULTI`` and not overridden then
+ the orginal projects settings for the GHS toolset and target system
+ customization cache variables are propagated into the external project.
+
``SOURCE_SUBDIR <dir>``
When no ``CONFIGURE_COMMAND`` option is specified, the configure step
assumes the external project has a ``CMakeLists.txt`` file at the top of
@@ -2849,18 +2853,6 @@ function(_ep_extract_configure_command var name)
set(has_cmake_cache_default_args 1)
endif()
- if(has_cmake_cache_args OR has_cmake_cache_default_args)
- set(_ep_cache_args_script "<TMP_DIR>/${name}-cache-$<CONFIG>.cmake")
- if(has_cmake_cache_args)
- _ep_command_line_to_initial_cache(script_initial_cache_force "${cmake_cache_args}" 1)
- endif()
- if(has_cmake_cache_default_args)
- _ep_command_line_to_initial_cache(script_initial_cache_default "${cmake_cache_default_args}" 0)
- endif()
- _ep_write_initial_cache(${name} "${_ep_cache_args_script}" "${script_initial_cache_force}${script_initial_cache_default}")
- list(APPEND cmd "-C${_ep_cache_args_script}")
- endif()
-
get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR)
get_target_property(cmake_generator_instance ${name} _EP_CMAKE_GENERATOR_INSTANCE)
get_target_property(cmake_generator_platform ${name} _EP_CMAKE_GENERATOR_PLATFORM)
@@ -2881,6 +2873,16 @@ function(_ep_extract_configure_command var name)
list(APPEND cmd "-G${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}")
else()
list(APPEND cmd "-G${CMAKE_GENERATOR}")
+ if("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
+ set(has_cmake_cache_default_args 1)
+ set(cmake_cache_default_args ${cmake_cache_default_args}
+ "-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()
endif()
if(cmake_generator_platform)
message(FATAL_ERROR "Option CMAKE_GENERATOR_PLATFORM not allowed without CMAKE_GENERATOR.")
@@ -2902,6 +2904,18 @@ function(_ep_extract_configure_command var name)
endif()
endif()
+ if(has_cmake_cache_args OR has_cmake_cache_default_args)
+ set(_ep_cache_args_script "<TMP_DIR>/${name}-cache-$<CONFIG>.cmake")
+ if(has_cmake_cache_args)
+ _ep_command_line_to_initial_cache(script_initial_cache_force "${cmake_cache_args}" 1)
+ endif()
+ if(has_cmake_cache_default_args)
+ _ep_command_line_to_initial_cache(script_initial_cache_default "${cmake_cache_default_args}" 0)
+ endif()
+ _ep_write_initial_cache(${name} "${_ep_cache_args_script}" "${script_initial_cache_force}${script_initial_cache_default}")
+ list(APPEND cmd "-C${_ep_cache_args_script}")
+ endif()
+
list(APPEND cmd "<SOURCE_DIR><SOURCE_SUBDIR>")
endif()