mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-05 13:50:10 -05:00
Merge topic 'generator-instance'
9ffb3538VS: Select and save a VS 2017 instance persistently17edfa41cmVSSetupHelper: Add option to specify an instancea19b8113CheckLanguage: Pass generator instance into check6b3cd64dExternalProject: Propagate the generator instance314613d1Add infrastructure for generators to select a build tool instance Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1394
This commit is contained in:
@@ -43,11 +43,17 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
|
||||
\"set(CMAKE_${lang}_COMPILER \\\"\${CMAKE_${lang}_COMPILER}\\\")\\n\"
|
||||
)
|
||||
")
|
||||
if(CMAKE_GENERATOR_INSTANCE)
|
||||
set(_D_CMAKE_GENERATOR_INSTANCE "-DCMAKE_GENERATOR_INSTANCE:INTERNAL=${CMAKE_GENERATOR_INSTANCE}")
|
||||
else()
|
||||
set(_D_CMAKE_GENERATOR_INSTANCE "")
|
||||
endif()
|
||||
execute_process(
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}
|
||||
COMMAND ${CMAKE_COMMAND} . -G ${CMAKE_GENERATOR}
|
||||
-A "${CMAKE_GENERATOR_PLATFORM}"
|
||||
-T "${CMAKE_GENERATOR_TOOLSET}"
|
||||
${_D_CMAKE_GENERATOR_INSTANCE}
|
||||
OUTPUT_VARIABLE output
|
||||
ERROR_VARIABLE output
|
||||
RESULT_VARIABLE result
|
||||
|
||||
@@ -381,6 +381,11 @@ External Project Definition
|
||||
:variable:`CMAKE_GENERATOR_TOOLSET`). It is an error to provide this
|
||||
option without the ``CMAKE_GENERATOR`` option.
|
||||
|
||||
``CMAKE_GENERATOR_INSTANCE <instance>``
|
||||
Pass a generator-specific instance selection to the CMake command (see
|
||||
:variable:`CMAKE_GENERATOR_INSTANCE`). It is an error to provide this
|
||||
option without the ``CMAKE_GENERATOR`` option.
|
||||
|
||||
``CMAKE_ARGS <arg>...``
|
||||
The specified arguments are passed to the ``cmake`` command line. They
|
||||
can be any argument the ``cmake`` command understands, not just cache
|
||||
@@ -2754,6 +2759,7 @@ function(_ep_extract_configure_command var name)
|
||||
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)
|
||||
get_target_property(cmake_generator_toolset ${name} _EP_CMAKE_GENERATOR_TOOLSET)
|
||||
if(cmake_generator)
|
||||
@@ -2764,6 +2770,9 @@ function(_ep_extract_configure_command var name)
|
||||
if(cmake_generator_toolset)
|
||||
list(APPEND cmd "-T${cmake_generator_toolset}")
|
||||
endif()
|
||||
if(cmake_generator_instance)
|
||||
list(APPEND cmd "-DCMAKE_GENERATOR_INSTANCE:INTERNAL=${cmake_generator_instance}")
|
||||
endif()
|
||||
else()
|
||||
if(CMAKE_EXTRA_GENERATOR)
|
||||
list(APPEND cmd "-G${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}")
|
||||
@@ -2782,6 +2791,12 @@ function(_ep_extract_configure_command var name)
|
||||
if(CMAKE_GENERATOR_TOOLSET)
|
||||
list(APPEND cmd "-T${CMAKE_GENERATOR_TOOLSET}")
|
||||
endif()
|
||||
if(cmake_generator_instance)
|
||||
message(FATAL_ERROR "Option CMAKE_GENERATOR_INSTANCE not allowed without CMAKE_GENERATOR.")
|
||||
endif()
|
||||
if(CMAKE_GENERATOR_INSTANCE)
|
||||
list(APPEND cmd "-DCMAKE_GENERATOR_INSTANCE:INTERNAL=${CMAKE_GENERATOR_INSTANCE}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND cmd "<SOURCE_DIR><SOURCE_SUBDIR>")
|
||||
|
||||
Reference in New Issue
Block a user