From 3966ab8e9f601a9315f19eea1bf24628664d79d9 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 31 May 2019 16:40:51 +0200 Subject: [PATCH] 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 --- cmake/QtBuild.cmake | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index ff430dd1198..0db99d07f14 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -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)