CMake: Fix qt_lib_XXX.pri files for modules with CONFIG_MODULE_NAME set

The function qt_generate_module_pri_file did not take into account the
CONFIG_MODULE_NAME argument of qt_add_module.
This resulted in wrong file names and content, e.g. qt_lib_test.pri
instead of qt_lib_testlib.pri.

Fixes: QTBUG-83176
Change-Id: Id6991396cf9ea5a1d155aa15402c0d84a8a9d082
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
This commit is contained in:
Joerg Bornemann 2020-03-30 14:12:34 +02:00
parent 3abacf39de
commit e0b89899e3

View File

@ -539,7 +539,7 @@ function(qt_is_imported_target target out_var)
endfunction() endfunction()
# Generates module .pri files for consumption by qmake # Generates module .pri files for consumption by qmake
function(qt_generate_module_pri_file target target_path pri_files_var) function(qt_generate_module_pri_file target target_path config_module_name pri_files_var)
set(flags INTERNAL_MODULE HEADER_MODULE) set(flags INTERNAL_MODULE HEADER_MODULE)
set(options) set(options)
set(multiopts QMAKE_MODULE_CONFIG) set(multiopts QMAKE_MODULE_CONFIG)
@ -572,53 +572,53 @@ function(qt_generate_module_pri_file target target_path pri_files_var)
if(arg_QMAKE_MODULE_CONFIG) if(arg_QMAKE_MODULE_CONFIG)
string(REPLACE ";" " " module_config "${arg_QMAKE_MODULE_CONFIG}") string(REPLACE ";" " " module_config "${arg_QMAKE_MODULE_CONFIG}")
set(module_config "\nQT.${module_lower}.CONFIG = ${module_config}") set(module_config "\nQT.${module_config_name}.CONFIG = ${module_config}")
else() else()
set(module_config "") set(module_config "")
endif() endif()
if (NOT ${arg_INTERNAL_MODULE}) if (NOT ${arg_INTERNAL_MODULE})
qt_path_join(pri_file_name "${target_path}" "qt_lib_${module_lower}.pri") qt_path_join(pri_file_name "${target_path}" "qt_lib_${config_module_name}.pri")
list(APPEND pri_files "${pri_file_name}") list(APPEND pri_files "${pri_file_name}")
file(GENERATE file(GENERATE
OUTPUT "${pri_file_name}" OUTPUT "${pri_file_name}"
CONTENT CONTENT
"QT.${module_lower}.VERSION = ${PROJECT_VERSION} "QT.${config_module_name}.VERSION = ${PROJECT_VERSION}
QT.${module_lower}.name = ${module} QT.${config_module_name}.name = ${module}
QT.${module_lower}.module = ${module_versioned} QT.${config_module_name}.module = ${module_versioned}
QT.${module_lower}.libs = $$QT_MODULE_LIB_BASE QT.${config_module_name}.libs = $$QT_MODULE_LIB_BASE
QT.${module_lower}.includes = $$QT_MODULE_INCLUDE_BASE $$QT_MODULE_INCLUDE_BASE/${module} QT.${config_module_name}.includes = $$QT_MODULE_INCLUDE_BASE $$QT_MODULE_INCLUDE_BASE/${module}
QT.${module_lower}.frameworks = QT.${config_module_name}.frameworks =
QT.${module_lower}.bins = $$QT_MODULE_BIN_BASE QT.${config_module_name}.bins = $$QT_MODULE_BIN_BASE
QT.${module_lower}.depends = QT.${config_module_name}.depends =
QT.${module_lower}.uses = QT.${config_module_name}.uses =
QT.${module_lower}.module_config = v2 QT.${config_module_name}.module_config = v2
QT.${module_lower}.DEFINES = QT_${module_define}_LIB QT.${config_module_name}.DEFINES = QT_${module_define}_LIB
QT.${module_lower}.enabled_features = ${enabled_features} QT.${config_module_name}.enabled_features = ${enabled_features}
QT.${module_lower}.disabled_features = ${disabled_features}${module_config} QT.${config_module_name}.disabled_features = ${disabled_features}${module_config}
QT_MODULES += ${module_lower} QT_MODULES += ${config_module_name}
" "
) )
endif() endif()
qt_path_join(private_pri_file "${target_path}" "qt_lib_${module_lower}_private.pri") qt_path_join(private_pri_file "${target_path}" "qt_lib_${config_module_name}_private.pri")
list(APPEND pri_files "${private_pri_file}") list(APPEND pri_files "${private_pri_file}")
file(GENERATE file(GENERATE
OUTPUT "${private_pri_file}" OUTPUT "${private_pri_file}"
CONTENT CONTENT
"QT.${module_lower}_private.VERSION = ${PROJECT_VERSION} "QT.${config_module_name}_private.VERSION = ${PROJECT_VERSION}
QT.${module_lower}_private.name = ${module} QT.${config_module_name}_private.name = ${module}
QT.${module_lower}_private.module = QT.${config_module_name}_private.module =
QT.${module_lower}_private.libs = $$QT_MODULE_LIB_BASE QT.${config_module_name}_private.libs = $$QT_MODULE_LIB_BASE
QT.${module_lower}_private.includes = $$QT_MODULE_INCLUDE_BASE/${module}/${PROJECT_VERSION} $$QT_MODULE_INCLUDE_BASE/${module}/${PROJECT_VERSION}/${module} QT.${config_module_name}_private.includes = $$QT_MODULE_INCLUDE_BASE/${module}/${PROJECT_VERSION} $$QT_MODULE_INCLUDE_BASE/${module}/${PROJECT_VERSION}/${module}
QT.${module_lower}_private.frameworks = QT.${config_module_name}_private.frameworks =
QT.${module_lower}_private.depends = ${module_lower} QT.${config_module_name}_private.depends = ${config_module_name}
QT.${module_lower}_private.uses = QT.${config_module_name}_private.uses =
QT.${module_lower}_private.module_config = v2 QT.${config_module_name}_private.module_config = v2
QT.${module_lower}_private.enabled_features = ${enabled_private_features} QT.${config_module_name}_private.enabled_features = ${enabled_private_features}
QT.${module_lower}_private.disabled_features = ${disabled_private_features} QT.${config_module_name}_private.disabled_features = ${disabled_private_features}
" "
) )
@ -2010,7 +2010,8 @@ set(QT_CMAKE_EXPORT_NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE})")
endif() endif()
qt_path_join(pri_target_path ${PROJECT_BINARY_DIR} ${INSTALL_MKSPECSDIR}/modules) qt_path_join(pri_target_path ${PROJECT_BINARY_DIR} ${INSTALL_MKSPECSDIR}/modules)
qt_generate_module_pri_file("${target}" "${pri_target_path}" module_pri_files qt_generate_module_pri_file("${target}" "${pri_target_path}" ${arg_CONFIG_MODULE_NAME}
module_pri_files
${arg_INTERNAL_MODULE} ${arg_INTERNAL_MODULE}
${header_module} ${header_module}
QMAKE_MODULE_CONFIG QMAKE_MODULE_CONFIG