ExternalProject: Propagate the generator toolset
When the CMAKE_GENERATOR option is given to ExternalProject_Add, look also for option CMAKE_GENERATOR_TOOLSET to select the value of the cmake "-T" command-line flag. When no CMAKE_GENERATOR option is given explicitly then use the current project's CMAKE_GENERATOR_TOOLSET (since we already use its CMAKE_GENERATOR).
This commit is contained in:
parent
e3841cf4a2
commit
daae0d2f5b
|
@ -38,6 +38,7 @@
|
||||||
# [CONFIGURE_COMMAND cmd...] # Build tree configuration command
|
# [CONFIGURE_COMMAND cmd...] # Build tree configuration command
|
||||||
# [CMAKE_COMMAND /.../cmake] # Specify alternative cmake executable
|
# [CMAKE_COMMAND /.../cmake] # Specify alternative cmake executable
|
||||||
# [CMAKE_GENERATOR gen] # Specify generator for native build
|
# [CMAKE_GENERATOR gen] # Specify generator for native build
|
||||||
|
# [CMAKE_GENERATOR_TOOLSET t] # Generator-specific toolset name
|
||||||
# [CMAKE_ARGS args...] # Arguments to CMake command line
|
# [CMAKE_ARGS args...] # Arguments to CMake command line
|
||||||
# [CMAKE_CACHE_ARGS args...] # Initial cache arguments, of the form -Dvar:string=on
|
# [CMAKE_CACHE_ARGS args...] # Initial cache arguments, of the form -Dvar:string=on
|
||||||
# #--Build step-----------------
|
# #--Build step-----------------
|
||||||
|
@ -1585,14 +1586,24 @@ function(_ep_add_configure_command name)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR)
|
get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR)
|
||||||
|
get_target_property(cmake_generator_toolset ${name} _EP_CMAKE_GENERATOR_TOOLSET)
|
||||||
if(cmake_generator)
|
if(cmake_generator)
|
||||||
list(APPEND cmd "-G${cmake_generator}")
|
list(APPEND cmd "-G${cmake_generator}")
|
||||||
|
if(cmake_generator_toolset)
|
||||||
|
list(APPEND cmd "-T${cmake_generator_toolset}")
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
if(CMAKE_EXTRA_GENERATOR)
|
if(CMAKE_EXTRA_GENERATOR)
|
||||||
list(APPEND cmd "-G${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}")
|
list(APPEND cmd "-G${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}")
|
||||||
else()
|
else()
|
||||||
list(APPEND cmd "-G${CMAKE_GENERATOR}")
|
list(APPEND cmd "-G${CMAKE_GENERATOR}")
|
||||||
endif()
|
endif()
|
||||||
|
if(cmake_generator_toolset)
|
||||||
|
message(FATAL_ERROR "Option CMAKE_GENERATOR_TOOLSET not allowed without CMAKE_GENERATOR.")
|
||||||
|
endif()
|
||||||
|
if(CMAKE_GENERATOR_TOOLSET)
|
||||||
|
list(APPEND cmd "-T${CMAKE_GENERATOR_TOOLSET}")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND cmd "${source_dir}")
|
list(APPEND cmd "${source_dir}")
|
||||||
|
|
Loading…
Reference in New Issue