mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-01 19:30:13 -06:00
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.
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
@@ -638,7 +638,7 @@ void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives(
|
||||
std::string tgt;
|
||||
const char* t =
|
||||
this->GetCMakeInstance()->GetCacheDefinition("GHS_PRIMARY_TARGET");
|
||||
if (t) {
|
||||
if (t && *t != '\0') {
|
||||
tgt = t;
|
||||
this->GetCMakeInstance()->MarkCliAsUsed("GHS_PRIMARY_TARGET");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user