summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmir Masoud Abdol <amirmasoudabdol@icloud.com>2023-01-11 14:02:13 +0100
committerAmir Masoud Abdol <amirmasoudabdol@icloud.com>2023-01-11 22:24:47 +0100
commitdc00369c56f5768bcbed06d6179ddb3f68fdfaf8 (patch)
treee37956183fb8123b84830a84f98272b29d524479
parent21bd782a6970ecb82beeac4d371ab5163d815350 (diff)
Replace the impl of qt_configure_file with qt_configure_file_v2
The new version uses PARSE_ARGV which deals with semicolons better. Task-number: QTBUG-99238 Change-Id: Ie9276219400326a67ffa9cf5fc456ae7de0bbcd2 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
-rw-r--r--cmake/QtCMakeHelpers.cmake18
-rw-r--r--cmake/QtSyncQtHelpers.cmake4
-rw-r--r--cmake/QtTargetHelpers.cmake18
3 files changed, 17 insertions, 23 deletions
diff --git a/cmake/QtCMakeHelpers.cmake b/cmake/QtCMakeHelpers.cmake
index b6f8d55e1a..1f488c2836 100644
--- a/cmake/QtCMakeHelpers.cmake
+++ b/cmake/QtCMakeHelpers.cmake
@@ -38,19 +38,13 @@ endmacro()
# output-file is relative to ${CMAKE_CURRENT_BINARY_DIR}
#
# This function is similar to file(GENERATE OUTPUT) except it writes the content
-# to the file at configure time, rather than at generate time. Once CMake 3.18 is released, it can
-# use file(CONFIGURE) in its implementation. Until then, it uses configure_file() with a generic
-# input file as source, when used with the CONTENT signature.
+# to the file at configure time, rather than at generate time.
+#
+# TODO: Once we require 3.18+, this can use file(CONFIGURE) in its implementation,
+# or maybe its usage can be replaced by file(CONFIGURE). Until then, it uses
+# configure_file() with a generic input file as source, when used with the CONTENT
+# signature.
function(qt_configure_file)
- qt_parse_all_arguments(arg "qt_configure_file" "" "OUTPUT;INPUT;CONTENT" "" ${ARGN})
- qt_configure_file_impl()
-endfunction()
-
-# The fixed version of qt_configure_file that uses the cmake_parse_arguments variant with PARSE_ARGV
-# to handle arguments with semicolons correctly.
-# TODO: This implementation should replace the previous one, but first need to fix all places where
-# the previous imlementation is used.
-function(qt_configure_file_v2)
cmake_parse_arguments(PARSE_ARGV 0 arg "" "OUTPUT;INPUT;CONTENT" "")
qt_configure_file_impl()
endfunction()
diff --git a/cmake/QtSyncQtHelpers.cmake b/cmake/QtSyncQtHelpers.cmake
index 1190b023d7..cbab85b19a 100644
--- a/cmake/QtSyncQtHelpers.cmake
+++ b/cmake/QtSyncQtHelpers.cmake
@@ -148,7 +148,7 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
)
list(JOIN syncqt_args "\n" syncqt_args_string)
set(syncqt_args_rsp "${binary_dir_real}/${target}_syncqt_args")
- qt_configure_file_v2(OUTPUT "${syncqt_args_rsp}" CONTENT "${syncqt_args_string}")
+ qt_configure_file(OUTPUT "${syncqt_args_rsp}" CONTENT "${syncqt_args_string}")
add_custom_command(
OUTPUT
@@ -180,7 +180,7 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
set(syncqt_all_args "${common_syncqt_arguments};-all")
list(JOIN syncqt_all_args "\n" syncqt_all_args_string)
set(syncqt_all_args_rsp "${binary_dir_real}/${target}_syncqt_all_args")
- qt_configure_file_v2(OUTPUT "${syncqt_all_args_rsp}" CONTENT "${syncqt_all_args_string}")
+ qt_configure_file(OUTPUT "${syncqt_all_args_rsp}" CONTENT "${syncqt_all_args_string}")
add_custom_target(${target}_sync_all_public_headers
COMMAND
${QT_CMAKE_EXPORT_NAMESPACE}::syncqt
diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake
index cf101c1f85..6d40ec7175 100644
--- a/cmake/QtTargetHelpers.cmake
+++ b/cmake/QtTargetHelpers.cmake
@@ -577,7 +577,7 @@ if(NOT TARGET ${full_target})
add_executable(${full_target} IMPORTED)
set_property(TARGET ${full_target} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${default_cfg})
set_target_properties(${full_target} PROPERTIES IMPORTED_LOCATION_${uc_default_cfg}
- \"$\\{PACKAGE_PREFIX_DIR}/${configure_time_target_install_location}\")
+ \"$\{PACKAGE_PREFIX_DIR}/${configure_time_target_install_location}\")
set_property(TARGET ${full_target} PROPERTY IMPORTED_GLOBAL TRUE)
endif()
\n")
@@ -592,10 +592,10 @@ endif()
string(APPEND content "
# ${full_target} is not built by default in the Debug configuration. Check existence.
get_target_property(_qt_imported_location ${full_target} IMPORTED_LOCATION_DEBUG)
-if(NOT EXISTS \"$\\{_qt_imported_location}\")
+if(NOT EXISTS \"$\{_qt_imported_location}\")
get_target_property(_qt_imported_configs ${full_target} IMPORTED_CONFIGURATIONS)
list(REMOVE_ITEM _qt_imported_configs DEBUG)
- set_property(TARGET ${full_target} PROPERTY IMPORTED_CONFIGURATIONS $\\{_qt_imported_configs})
+ set_property(TARGET ${full_target} PROPERTY IMPORTED_CONFIGURATIONS $\{_qt_imported_configs})
set_property(TARGET ${full_target} PROPERTY IMPORTED_LOCATION_DEBUG)
endif()\n")
endif()
@@ -622,12 +622,12 @@ endif()\n")
string(APPEND content "get_target_property(_qt_imported_soname ${full_target} IMPORTED_SONAME_${uc_release_cfg})\n")
endif()
endif()
- string(APPEND content "get_target_property(_qt_imported_location_default ${full_target} IMPORTED_LOCATION_$\\{QT_DEFAULT_IMPORT_CONFIGURATION})\n")
+ string(APPEND content "get_target_property(_qt_imported_location_default ${full_target} IMPORTED_LOCATION_$\{QT_DEFAULT_IMPORT_CONFIGURATION})\n")
if(write_implib)
- string(APPEND content "get_target_property(_qt_imported_implib_default ${full_target} IMPORTED_IMPLIB_$\\{QT_DEFAULT_IMPORT_CONFIGURATION})\n")
+ string(APPEND content "get_target_property(_qt_imported_implib_default ${full_target} IMPORTED_IMPLIB_$\{QT_DEFAULT_IMPORT_CONFIGURATION})\n")
endif()
if(write_soname)
- string(APPEND content "get_target_property(_qt_imported_soname_default ${full_target} IMPORTED_SONAME_$\\{QT_DEFAULT_IMPORT_CONFIGURATION})\n")
+ string(APPEND content "get_target_property(_qt_imported_soname_default ${full_target} IMPORTED_SONAME_$\{QT_DEFAULT_IMPORT_CONFIGURATION})\n")
endif()
foreach(config ${configurations_to_export} "")
string(TOUPPER "${config}" ucconfig)
@@ -645,18 +645,18 @@ set_property(TARGET ${full_target} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${ucc
endif()
string(APPEND content "
if(_qt_imported_location${var_suffix})
- set_property(TARGET ${full_target} PROPERTY IMPORTED_LOCATION${property_suffix} \"$\\{_qt_imported_location${var_suffix}}\")
+ set_property(TARGET ${full_target} PROPERTY IMPORTED_LOCATION${property_suffix} \"$\{_qt_imported_location${var_suffix}}\")
endif()")
if(write_implib)
string(APPEND content "
if(_qt_imported_implib${var_suffix})
- set_property(TARGET ${full_target} PROPERTY IMPORTED_IMPLIB${property_suffix} \"$\\{_qt_imported_implib${var_suffix}}\")
+ set_property(TARGET ${full_target} PROPERTY IMPORTED_IMPLIB${property_suffix} \"$\{_qt_imported_implib${var_suffix}}\")
endif()")
endif()
if(write_soname)
string(APPEND content "
if(_qt_imported_soname${var_suffix})
- set_property(TARGET ${full_target} PROPERTY IMPORTED_SONAME${property_suffix} \"$\\{_qt_imported_soname${var_suffix}}\")
+ set_property(TARGET ${full_target} PROPERTY IMPORTED_SONAME${property_suffix} \"$\{_qt_imported_soname${var_suffix}}\")
endif()")
endif()
string(APPEND content "\n")