mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-26 20:07:50 +08:00
261 lines
14 KiB
Diff
261 lines
14 KiB
Diff
|
diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
|
||
|
index 81db0d92c..51016f3fa 100644
|
||
|
--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
|
||
|
+++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
|
||
|
@@ -1,6 +1,6 @@
|
||
|
|
||
|
-if (CMAKE_VERSION VERSION_LESS 3.1.0)
|
||
|
- message(FATAL_ERROR \"Qt 5 $${CMAKE_MODULE_NAME} module requires at least CMake version 3.1.0\")
|
||
|
+if (CMAKE_VERSION VERSION_LESS 3.6.0) # Increase for cmake_parse_arguments
|
||
|
+ message(FATAL_ERROR \"Qt 5 $${CMAKE_MODULE_NAME} module requires at least CMake version 3.6.0\")
|
||
|
endif()
|
||
|
|
||
|
!!IF !isEmpty(CMAKE_USR_MOVE_WORKAROUND)
|
||
|
@@ -34,6 +34,167 @@ set(Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING "$$eval(QT.$${MODULE}.VERSION)")
|
||
|
set(Qt5$${CMAKE_MODULE_NAME}_LIBRARIES Qt5::$${CMAKE_MODULE_NAME})
|
||
|
!!ENDIF // TEMPLATE != aux
|
||
|
|
||
|
+###### Added by VCPKG
|
||
|
+function(_qt5_$${CMAKE_MODULE_NAME}_parse_prl)
|
||
|
+ cmake_parse_arguments(_qt_prl \"\" \"CONFIGURATION;TARGET;PRL_FILE;LIB_FILE;OUT_DEPS;OUT_FLAGS\" \"\" ${ARGN})
|
||
|
+ if(NOT _qt_prl_CONFIGURATION)
|
||
|
+ message(FATAL_ERROR \"qt_parse_prl requires parameter CONFIGURATION\")
|
||
|
+ endif()
|
||
|
+ if(NOT _qt_prl_TARGET)
|
||
|
+ message(FATAL_ERROR \"qt_parse_prl requires parameter TARGET\")
|
||
|
+ endif()
|
||
|
+ if(NOT _qt_prl_PRL_FILE AND NOT _qt_prl_LIB_FILE)
|
||
|
+ message(FATAL_ERROR \"qt_parse_prl requires parameter PRL_FILE or LIB_FILE\")
|
||
|
+ endif()
|
||
|
+ if(NOT _qt_prl_OUT_DEPS)
|
||
|
+ message(FATAL_ERROR \"qt_parse_prl requires parameter OUT_DEPS\")
|
||
|
+ endif()
|
||
|
+ if(NOT _qt_prl_OUT_FLAGS)
|
||
|
+ message(FATAL_ERROR \"qt_parse_prl requires parameter OUT_FLAGS\")
|
||
|
+ endif()
|
||
|
+
|
||
|
+ if(_qt_prl_LIB_FILE)
|
||
|
+ set(_parsed_prl \"${_qt_prl_LIB_FILE}\")
|
||
|
+ string(REGEX REPLACE \"${CMAKE_STATIC_LIBRARY_SUFFIX}$\" \".prl\" _parsed_prl \"${_parsed_prl}\")
|
||
|
+ else()
|
||
|
+ set(_parsed_prl \"${_qt_prl_PRL_FILE}\")
|
||
|
+ endif()
|
||
|
+
|
||
|
+ #message(STATUS \"Reading file: ${_parsed_prl}\")
|
||
|
+ if(NOT EXISTS \"${_parsed_prl}\")
|
||
|
+ message(FATAL_ERROR \"Could not find PRL file: ${_parsed_prl}\")
|
||
|
+ endif()
|
||
|
+ file(STRINGS \"${_parsed_prl}\" _static_depends REGEX \"^QMAKE_PRL_LIBS[ \\t]+=[ \\t]+.+$\")
|
||
|
+ #message(STATUS \"QMAKE_PRL_LIBS from ${_parsed_prl} as read : ${_static_depends}\n\n\")
|
||
|
+ string(REGEX REPLACE \"QMAKE_PRL_LIBS[ \\t]+=[ \\t]+\" \"\" _static_depends \"${_static_depends}\")
|
||
|
+ string(REGEX REPLACE \" -L\\\\$\\\\$([^ ]+)\" [[ ;-L\$\$\\1; ]] _static_depends \"${_static_depends}\") # - L Normal Case
|
||
|
+ if(WIN32)
|
||
|
+ string(REGEX REPLACE \"-L\\\\\\\"([^\\\\\\\"]+)\\\\\\\"\" \" ;-L\\\"\\\\1\\\"; \" _static_depends \"${_static_depends}\") # -L Tricky Case with spaces
|
||
|
+ string(REGEX REPLACE [[\\\"?[A-Z]:\\\\\\\\Program Files( \\(x86\\))*\\\\\\\\Windows Kits\\\\\\\\[0-9]+\\\\\\\\lib\\\\\\\\[0-9|.]+\\\\\\\\um\\\\\\\\x64(\\\\\\\\|/)([^\\\"]+)\\\"?]] \";\\\\3;\" _static_depends \"${_static_depends}\")
|
||
|
+ string(REGEX REPLACE [[ \\\"([^\\"]+)\\\" ]] \" ;\\\"\\\\1\\\"; \" _static_depends \"${_static_depends}\")
|
||
|
+ # Every path with a space in it should be handled now!
|
||
|
+ else()
|
||
|
+ string(REGEX REPLACE \" -l([^ ]+)\" [[;-l\\1;]] _static_depends \"${_static_depends}\") # - l case on targets other than windows
|
||
|
+ endif()
|
||
|
+ string(REGEX REPLACE \"[\\t ]+[^\\\\\\\"]([^( |\\\\\\\")]+)[^\\\\\\\"]([\\t ]+|[\\t ]*$)\" \";\\\\0; \" _static_depends \"${_static_depends}\")
|
||
|
+ string(REGEX REPLACE \"[\\t ]*;[\\t ]*\" \";\" _static_depends \"${_static_depends}\") # remove unnecessary whitespaces
|
||
|
+ string(REGEX REPLACE \"(;[\\t ]*;)+\" \";\" _static_depends \"${_static_depends}\") # remove empty elements from the list
|
||
|
+ #string(REGEX REPLACE \" [\\"]\" \";\\\\\\\"\" _static_depends \"${_static_depends}\")
|
||
|
+ #message(STATUS \"QMAKE_PRL_LIBS as a list : ${_static_depends}\n\n\")
|
||
|
+
|
||
|
+ #Logic Backported from Qt 5.14
|
||
|
+ set(_search_paths)
|
||
|
+ set(_fw_search_paths)
|
||
|
+ set(_framework_flag)
|
||
|
+ if(\"${_qt_prl_CONFIGURATION}\" STREQUAL \"DEBUG\")
|
||
|
+ set(_prl_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/debug/$${CMAKE_LIB_DIR}${LIB_LOCATION}\")
|
||
|
+ else()
|
||
|
+ set(_prl_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}${LIB_LOCATION}\")
|
||
|
+ endif()
|
||
|
+ string(REPLACE \"\$\$[QT_INSTALL_LIBS]/\" \"${_prl_location}\" _static_depends \"${_static_depends}\")
|
||
|
+ string(REGEX REPLACE \"[ \t]+\" \";\" _standard_libraries \"${CMAKE_CXX_STANDARD_LIBRARIES}\")
|
||
|
+ foreach(_flag IN LISTS _static_depends)
|
||
|
+ if(_flag MATCHES \"^-framework$\")
|
||
|
+ # Handle the next flag as framework name
|
||
|
+ set(_framework_flag 1)
|
||
|
+ elseif(_flag MATCHES \"^-F(.*)$\")
|
||
|
+ # Handle -F/foo/bar flags by recording the framework search paths to be used
|
||
|
+ # by find_library.
|
||
|
+ list(APPEND _fw_search_paths \"${CMAKE_MATCH_1}\")
|
||
|
+ elseif(_framework_flag OR _flag MATCHES \"^-l(.*)$\")
|
||
|
+ if(_framework_flag)
|
||
|
+ # Handle Darwin framework bundles passed as -framework Foo
|
||
|
+ unset(_framework_flag)
|
||
|
+ set(_lib ${_flag})
|
||
|
+ else()
|
||
|
+ # Handle normal libraries passed as -lfoo
|
||
|
+ set(_lib \"${CMAKE_MATCH_1}\")
|
||
|
+ foreach(_standard_library ${_standard_libraries})
|
||
|
+ if(_standard_library MATCHES \"^${_lib}(\\\\.lib)?$\")
|
||
|
+ set(_lib_is_default_linked TRUE)
|
||
|
+ break()
|
||
|
+ endif()
|
||
|
+ endforeach()
|
||
|
+ endif()
|
||
|
+ 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()
|
||
|
+ set(current_search_paths \"${_search_paths}\")
|
||
|
+ if(_framework_flag)
|
||
|
+ set(current_search_paths \"${_fw_search_paths}\")
|
||
|
+ endif()
|
||
|
+ if(current_search_paths)
|
||
|
+ find_library(_Qt5$${CMAKE_MODULE_NAME}_${Configuration}_${_lib}_PATH ${_lib} HINTS ${current_search_paths} NO_DEFAULT_PATH)
|
||
|
+ endif()
|
||
|
+ find_library(_Qt5$${CMAKE_MODULE_NAME}_${Configuration}_${_lib}_PATH ${_lib})
|
||
|
+ mark_as_advanced(_Qt5$${CMAKE_MODULE_NAME}_${Configuration}_${_lib}_PATH)
|
||
|
+ if(_Qt5$${CMAKE_MODULE_NAME}_${Configuration}_${_lib}_PATH)
|
||
|
+ list(APPEND _lib_deps
|
||
|
+ ${_Qt5$${CMAKE_MODULE_NAME}_${Configuration}_${_lib}_PATH}
|
||
|
+ )
|
||
|
+ else()
|
||
|
+ message(FATAL_ERROR \"Library not found: ${_lib}\")
|
||
|
+ endif()
|
||
|
+ unset(_framework_flag)
|
||
|
+ endif()
|
||
|
+ elseif(EXISTS \"${_flag}\")
|
||
|
+ # The flag is an absolute path to an existing library
|
||
|
+ list(APPEND _lib_deps \"${_flag}\")
|
||
|
+ elseif(_flag MATCHES \"^-L(.*)$\")
|
||
|
+ # Handle -Lfoo flags by putting their paths in the search path used by find_library above
|
||
|
+ list(APPEND _search_paths \"${CMAKE_MATCH_1}\")
|
||
|
+ elseif(_flag MATCHES \"\\\.(lib|a|so)$\") #Library name only. No -l. Probably missing some cases
|
||
|
+ #message(STATUS \"Added to link deps (${Configuration}): ${_flag}\")
|
||
|
+ list(APPEND _lib_deps ${_flag}) # changed from _link_flags
|
||
|
+ else()
|
||
|
+ # Handle all remaining flags by simply passing them to the linker
|
||
|
+ #message(STATUS \"Added to link flags (${Configuration}): ${_flag}\")
|
||
|
+ list(APPEND _lib_flags ${_flag}) # changed from _link_flags
|
||
|
+ endif()
|
||
|
+ endforeach()
|
||
|
+
|
||
|
+ #message(STATUS \"${_qt_prl_TARGET} links (via PRL ${_qt_prl_CONFIGURATION}): ${_lib_deps}\")
|
||
|
+ #message(STATUS \"${_qt_prl_TARGET} has linker flags (via PRL): ${_lib_flags}\")
|
||
|
+ #get_target_property(_test_interface ${_qt_prl_TARGET} INTERFACE_LINK_LIBRARIES)
|
||
|
+ #message(STATUS \"INTERFACE_LINK_LIBRARIES of target before ${_qt_prl_TARGET}: ${_test_interface} \")
|
||
|
+ set(_prl_out_libs)
|
||
|
+ foreach(_prl_lib IN LISTS _lib_deps)
|
||
|
+ if(\"${_qt_prl_CONFIGURATION}\" STREQUAL \"DEBUG\")
|
||
|
+ #message(STATUS \"DEBUG: ${_prl_lib}\")
|
||
|
+ #set_property(TARGET ${_qt_prl_TARGET} APPEND PROPERTY INTERFACE_LINK_LIBRARIES \"\\$<\\$<CONFIG:DEBUG>:${_prl_lib}>\")
|
||
|
+ list(APPEND _prl_out_libs \"\\$<\\$<CONFIG:DEBUG>:${_prl_lib}>\")
|
||
|
+ else()
|
||
|
+ #message(STATUS \"RELEASE: ${_prl_lib}\")
|
||
|
+ #set_property(TARGET ${_qt_prl_TARGET} APPEND PROPERTY INTERFACE_LINK_LIBRARIES \"\\$<\\$<NOT:\\$<CONFIG:DEBUG>>:${_prl_lib}>\")
|
||
|
+ list(APPEND _prl_out_libs \"\\$<\\$<NOT:\\$<CONFIG:DEBUG>>:${_prl_lib}>\")
|
||
|
+ endif()
|
||
|
+ endforeach()
|
||
|
+ set(${_qt_prl_OUT_DEPS} "${_prl_out_libs}" PARENT_SCOPE)
|
||
|
+ unset(_prl_lib)
|
||
|
+
|
||
|
+ set(_prl_out_flags)
|
||
|
+ foreach(_prl_flag IN LISTS _lib_flags)
|
||
|
+ if(\"${_qt_prl_CONFIGURATION}\" STREQUAL \"DEBUG\")
|
||
|
+ #set_property(TARGET ${_qt_prl_TARGET} APPEND PROPERTY INTERFACE_LINK_LIBRARIES \"\\$<\\$<CONFIG:DEBUG>:${_prl_flag}>\")
|
||
|
+ list(APPEND _prl_out_flags \"\\$<\\$<CONFIG:DEBUG>:${_prl_flag}>\")
|
||
|
+ else()
|
||
|
+ #set_property(TARGET ${_qt_prl_TARGET} APPEND PROPERTY INTERFACE_LINK_LIBRARIES \"\\$<\\$<NOT:\\$<CONFIG:DEBUG>>:${_prl_flag}>\")
|
||
|
+ list(APPEND _prl_out_flags \"\\$<\\$<NOT:\\$<CONFIG:DEBUG>>:${_prl_flag}>\")
|
||
|
+ endif()
|
||
|
+ endforeach()
|
||
|
+ set(${_qt_prl_OUT_FLAGS} "${_prl_out_flags}" PARENT_SCOPE)
|
||
|
+ unset(_prl_flag)
|
||
|
+
|
||
|
+ #get_target_property(_test_interface ${_qt_prl_TARGET} INTERFACE_LINK_LIBRARIES)
|
||
|
+ #message(STATUS \"INTERFACE_LINK_LIBRARIES of target after ${_qt_prl_TARGET}: ${_test_interface} \")
|
||
|
+endfunction()
|
||
|
+
|
||
|
+###### END Added by VCPKG
|
||
|
+
|
||
|
+
|
||
|
macro(_qt5_$${CMAKE_MODULE_NAME}_check_file_exists file)
|
||
|
if(NOT EXISTS \"${file}\" )
|
||
|
message(FATAL_ERROR \"The imported target \\\"Qt5::$${CMAKE_MODULE_NAME}\\\" references the file
|
||
|
@@ -52,6 +189,24 @@ endmacro()
|
||
|
macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION)
|
||
|
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
|
||
|
|
||
|
+!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
|
||
|
+!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
|
||
|
+ if(\"${Configuration}\" STREQUAL \"DEBUG\")
|
||
|
+ set(imported_implib \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/debug/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
|
||
|
+ else()
|
||
|
+ set(imported_implib \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
|
||
|
+ endif()
|
||
|
+!!ELSE
|
||
|
+ set(imported_implib \"IMPORTED_IMPLIB_${Configuration}\" \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
|
||
|
+!!ENDIF
|
||
|
+ _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_implib})
|
||
|
+ if(NOT \"${IMPLIB_LOCATION}\" STREQUAL \"\")
|
||
|
+ set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
|
||
|
+ \"IMPORTED_IMPLIB_${Configuration}\" ${imported_implib}
|
||
|
+ )
|
||
|
+ endif()
|
||
|
+!!ENDIF
|
||
|
+
|
||
|
!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
|
||
|
if(\"${Configuration}\" STREQUAL \"DEBUG\")
|
||
|
set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/debug/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
|
||
|
@@ -60,35 +215,24 @@ macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATI
|
||
|
endif()
|
||
|
!!ELSE
|
||
|
set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
|
||
|
+!!ENDIF
|
||
|
+!!IF !isEmpty(CMAKE_STATIC_TYPE)
|
||
|
+ _qt5_$${CMAKE_MODULE_NAME}_parse_prl(TARGET Qt5::$${CMAKE_MODULE_NAME} LIB_FILE \"${imported_location}\" CONFIGURATION \"${Configuration}\" OUT_DEPS PRL_DEPS OUT_FLAGS PRL_FLAGS)
|
||
|
+!!ELSE
|
||
|
+ _qt5_$${CMAKE_MODULE_NAME}_parse_prl(TARGET Qt5::$${CMAKE_MODULE_NAME} LIB_FILE \"${imported_implib}\" CONFIGURATION \"${Configuration}\" OUT_DEPS PRL_DEPS OUT_FLAGS PRL_FLAGS)
|
||
|
!!ENDIF
|
||
|
_qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
|
||
|
+ set_property(TARGET ${_qt_prl_TARGET} APPEND PROPERTY INTERFACE_LINK_LIBRARIES \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES};${PRL_DEPS};${PRL_FLAGS}\")
|
||
|
set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
|
||
|
- \"INTERFACE_LINK_LIBRARIES\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
|
||
|
+ #\"INTERFACE_LINK_LIBRARIES\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES};${PRL_DEPS};${PRL_FLAGS}\"
|
||
|
\"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
|
||
|
!!IF !isEmpty(CMAKE_LIB_SONAME)
|
||
|
\"IMPORTED_SONAME_${Configuration}\" \"$${CMAKE_LIB_SONAME}\"
|
||
|
!!ENDIF
|
||
|
# For backward compatibility with CMake < 2.8.12
|
||
|
- \"IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
|
||
|
+ \"IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES};${PRL_DEPS};${PRL_FLAGS}\"
|
||
|
)
|
||
|
|
||
|
-!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
|
||
|
-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
|
||
|
- if(\"${Configuration}\" STREQUAL \"DEBUG\")
|
||
|
- set(imported_implib \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/debug/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
|
||
|
- else()
|
||
|
- set(imported_implib \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
|
||
|
- endif()
|
||
|
-!!ELSE
|
||
|
- set(imported_implib \"IMPORTED_IMPLIB_${Configuration}\" \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
|
||
|
-!!ENDIF
|
||
|
- _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_implib})
|
||
|
- if(NOT \"${IMPLIB_LOCATION}\" STREQUAL \"\")
|
||
|
- set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
|
||
|
- \"IMPORTED_IMPLIB_${Configuration}\" ${imported_implib}
|
||
|
- )
|
||
|
- endif()
|
||
|
-!!ENDIF
|
||
|
endmacro()
|
||
|
!!ENDIF
|
||
|
|
||
|
@@ -366,6 +510,8 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
|
||
|
set_target_properties(Qt5::${Plugin} PROPERTIES
|
||
|
\"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
|
||
|
)
|
||
|
+ _qt5_$${CMAKE_MODULE_NAME}_parse_prl(TARGET Qt5::${Plugin} LIB_FILE \"${imported_location}\" CONFIGURATION \"${Configuration}\" OUT_DEPS PRL_DEPS OUT_FLAGS PRL_FLAGS)
|
||
|
+ set_property(TARGET Qt5::${Plugin} APPEND PROPERTY INTERFACE_LINK_LIBRARIES \"${PRL_DEPS};${PRL_FLAGS}\")
|
||
|
endmacro()
|
||
|
|
||
|
if (pluginTargets)
|
||
|
|