Add build type (debug) and static vs dynamic to CONFIG in qconfig.pri

Also fix the QT_BUILD_SHARED_LIBS usage. While building qtbase, it
is assigned later than the call for
qt_generate_global_config_pri_file(), so it used always choose static.
Make sure to check for BUILD_SHARED_LIBS as well.

Change-Id: I66f03e5adacc89646147fc96154bee8002b2b9cc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Alexandru Croitor 2019-05-31 16:40:51 +02:00
parent d53f22e2fb
commit 3966ab8e9f

View File

@ -341,12 +341,14 @@ function(qt_generate_global_config_pri_file)
get_target_property(disabled_features GlobalConfig INTERFACE_QT_DISABLED_PUBLIC_FEATURES)
# configure2cmake skips the "static" feature, so emulate it here for qmake support:
if(${QT_BUILD_SHARED_LIBS})
if(QT_BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
list(APPEND enabled_features shared)
list(APPEND disabled_features static)
set(qt_build_config_type "shared")
else()
list(APPEND enabled_features static)
list(APPEND disabled_features shared)
set(qt_build_config_type "static")
endif()
# configure2cmake skips the "rpath" feature, so emulate it here for qmake support:
@ -359,6 +361,16 @@ function(qt_generate_global_config_pri_file)
string (REPLACE ";" " " enabled_features "${enabled_features}")
string (REPLACE ";" " " disabled_features "${disabled_features}")
# Add some required CONFIG entries.
set(config_entries "")
if(CMAKE_BUILD_TYPE STREQUAL Debug)
list(APPEND config_entries "debug")
elseif(CMAKE_BUILD_TYPE STREQUAL Release)
list(APPEND config_entries "release")
endif()
list(APPEND config_entries "${qt_build_config_type}")
string (REPLACE ";" " " config_entries "${config_entries}")
file(GENERATE
OUTPUT "${qconfig_pri_target_path}"
CONTENT
@ -371,6 +383,7 @@ QT_MAJOR_VERSION = ${PROJECT_VERSION_MAJOR}
QT_MINOR_VERSION = ${PROJECT_VERSION_MINOR}
QT_PATCH_VERSION = ${PROJECT_VERSION_PATCH}
CONFIG -= link_prl # we do not create prl files right now
CONFIG += ${config_entries}
"
)
qt_install(FILES "${qconfig_pri_target_path}" DESTINATION mkspecs)