summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-07-11 17:17:13 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-07-11 17:17:51 +0200
commit4dac45c9ee59ff6586d90d423654da91523ab679 (patch)
treecd4a4adf2cbc9e77bf86d2d11e71ec66afdf3be4 /mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
parent078cd61751aeaa310d35a3d596a21a36004a1a0f (diff)
parentf44850b5c3464cdda0ee9b1ee858d95f3ffaa3e2 (diff)
Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Diffstat (limited to 'mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in')
-rw-r--r--mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in24
1 files changed, 20 insertions, 4 deletions
diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
index aca8703238..ba7d9575c0 100644
--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
@@ -56,9 +56,17 @@ function(_qt5_$${CMAKE_MODULE_NAME}_process_prl_file prl_file_location Configura
get_filename_component(_qt5_install_libs \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/lib\" ABSOLUTE)
if(EXISTS \"${prl_file_location}\")
- file(STRINGS \"${prl_file_location}\" _prl_strings REGEX \"QMAKE_PRL_LIBS[ \\t]*=\")
- string(REGEX REPLACE \"QMAKE_PRL_LIBS[ \\t]*=[ \\t]*([^\\n]*)\" \"\\\\1\" _static_depends ${_prl_strings})
- string(REGEX REPLACE \"[ \\t]+\" \";\" _static_depends ${_static_depends})
+ file(STRINGS \"${prl_file_location}\" _prl_strings REGEX \"QMAKE_PRL_LIBS_FOR_CMAKE[ \\t]*=\")
+
+ # file(STRINGS) replaces all semicolons read from the file with backslash semicolons.
+ # We need to do a reverse transformation in CMake. For that we replace all backslash
+ # semicolons with just semicolons, but due to the qmake substitution feature
+ # creating this file, we need to double the amount of backslashes, so the final file
+ # should have three backslashes and one semicolon.
+ string(REGEX REPLACE \"\\\\\\;\" \";\" _prl_strings \"${_prl_strings}\")
+
+ string(REGEX REPLACE \"QMAKE_PRL_LIBS_FOR_CMAKE[ \\t]*=[ \\t]*([^\\n]*)\" \"\\\\1\" _static_depends \"${_prl_strings}\")
+ string(REGEX REPLACE \"[ \\t]+\" \";\" _standard_libraries \"${CMAKE_CXX_STANDARD_LIBRARIES}\")
set(_search_paths)
string(REPLACE \"\\$\\$[QT_INSTALL_LIBS]\" \"${_qt5_install_libs}\" _static_depends \"${_static_depends}\")
foreach(_flag ${_static_depends})
@@ -66,7 +74,15 @@ function(_qt5_$${CMAKE_MODULE_NAME}_process_prl_file prl_file_location Configura
if(_flag MATCHES \"^-l(.*)$\")
# Handle normal libraries passed as -lfoo
set(_lib \"${CMAKE_MATCH_1}\")
- if(_lib MATCHES \"^pthread$\")
+ foreach(_standard_library ${_standard_libraries})
+ if(_standard_library MATCHES \"^${_lib}(\\.lib)?$\")
+ set(_lib_is_default_linked TRUE)
+ break()
+ endif()
+ endforeach()
+ if (_lib_is_default_linked)
+ unset(_lib_is_default_linked)
+ elseif(_lib MATCHES \"^pthread$\")
find_package(Threads REQUIRED)
list(APPEND _lib_deps Threads::Threads)
else()