diff options
author | Brad King <brad.king@kitware.com> | 2017-10-03 19:06:08 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-10-19 14:20:11 (GMT) |
commit | 6b3cd64d42740618e0df6507194076185c1d91e2 (patch) | |
tree | 2f4285030a4a620ea7c78ec51ac143f30e463f9d /Modules | |
parent | 314613d1afd069dd896aa0d5112dfbf2b82af3c3 (diff) | |
download | CMake-6b3cd64d42740618e0df6507194076185c1d91e2.zip CMake-6b3cd64d42740618e0df6507194076185c1d91e2.tar.gz CMake-6b3cd64d42740618e0df6507194076185c1d91e2.tar.bz2 |
ExternalProject: Propagate the generator instance
When the `CMAKE_GENERATOR` option is given to `ExternalProject_Add`,
look also for option `CMAKE_GENERATOR_INSTANCE` to pass on to cmake as a
cache definition. When no `CMAKE_GENERATOR` option is given explicitly
then use the current project's `CMAKE_GENERATOR_INSTANCE` (since we
already use its CMAKE_GENERATOR).
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/ExternalProject.cmake | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 5897e74..67aac4f 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -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>") |