Suppress cmake warning about empty string argument

When generating .pc files there is a warning when executing
QtFinishPkgConfigFile.cmake:

  Ignoring empty string ("") provided on the command line.

This happens because the 'postfix' argument is a part of the script
command line even if it's empty. It also makes no sense to check if
'postfix' is empty using genex, use configuring-time check instead.

Pick-to: 6.2 6.3
Change-Id: If52d9634f4885caefb828976b3c99592a6db3d3c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Alexey Edelev 2022-04-11 15:35:52 +02:00
parent b8677bd31f
commit 8eef32d460

View File

@ -119,6 +119,12 @@ function(qt_internal_generate_pkg_config_file module)
else()
set(postfix "")
endif()
set(extra_args "")
if(NOT postfix STREQUAL "")
list(APPEND extra_args "-DPOSTFIX=${postfix}")
endif()
qt_path_join(pc_step2_path "${build_dir}" ${step_prefix}_${config}_step2.pc)
qt_path_join(final_pc_path "${build_dir}" ${pkgconfig_file}${postfix}.pc)
@ -129,7 +135,7 @@ function(qt_internal_generate_pkg_config_file module)
COMMAND ${CMAKE_COMMAND}
"-DIN_FILE=${pc_step2_path}"
"-DOUT_FILE=${final_pc_path}"
"$<$<BOOL:${postfix}>:-DPOSTFIX=${postfix}>"
${extra_args}
-P "${QT_CMAKE_DIR}/QtFinishPkgConfigFile.cmake"
VERBATIM
COMMENT "Generating pc file for target ${target}"