Do not override the generator type in configure script
If '-G<generator type>' is passed to configure script we should respect this argument but not override it by the autodetected generator type. '-cmake-generator' option will still have higher priority, but if generator is set using CMake argument it will not be auto-detected by other build config specific options, like '-debug-and-release'. Change-Id: I75b49e33fa717f90bbd74045948fccb9f5350e8d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
33f7eb44ff
commit
139f3f61bd
@ -148,6 +148,37 @@ while(NOT "${configure_args}" STREQUAL "")
|
||||
endif()
|
||||
endwhile()
|
||||
|
||||
# Read the specified manually generator value from CMake command line.
|
||||
# The '-cmake-generator' argument has higher priority than CMake command line.
|
||||
if(NOT generator)
|
||||
set(is_next_arg_generator_name FALSE)
|
||||
foreach(arg IN LISTS cmake_args)
|
||||
if(is_next_arg_generator_name)
|
||||
set(is_next_arg_generator_name FALSE)
|
||||
if(NOT arg MATCHES "^-.*")
|
||||
set(generator "${arg}")
|
||||
set(auto_detect_generator FALSE)
|
||||
endif()
|
||||
elseif(arg MATCHES "^-G(.*)")
|
||||
set(generator "${CMAKE_MATCH_1}")
|
||||
if(generator)
|
||||
set(auto_detect_generator FALSE)
|
||||
else()
|
||||
set(is_next_arg_generator_name TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Attempt to detect the generator type, either single or multi-config
|
||||
if("${generator}" STREQUAL "Xcode"
|
||||
OR "${generator}" STREQUAL "Ninja Multi-Config"
|
||||
OR "${generator}" MATCHES "^Visual Studio")
|
||||
set(multi_config ON)
|
||||
else()
|
||||
set(multi_config OFF)
|
||||
endif()
|
||||
|
||||
if(FRESH_REQUESTED)
|
||||
push("-DQT_INTERNAL_FRESH_REQUESTED:BOOL=TRUE")
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24")
|
||||
@ -897,9 +928,9 @@ if(INPUT_force_debug_info)
|
||||
endif()
|
||||
|
||||
list(LENGTH build_configs nr_of_build_configs)
|
||||
if(nr_of_build_configs EQUAL 1)
|
||||
if(nr_of_build_configs EQUAL 1 AND NOT multi_config)
|
||||
push("-DCMAKE_BUILD_TYPE=${build_configs}")
|
||||
elseif(nr_of_build_configs GREATER 1)
|
||||
elseif(nr_of_build_configs GREATER 1 OR multi_config)
|
||||
set(multi_config ON)
|
||||
string(REPLACE ";" "[[;]]" escaped_build_configs "${build_configs}")
|
||||
# We must not use the push macro here to avoid variable expansion.
|
||||
|
Loading…
Reference in New Issue
Block a user