summarylogtreecommitdiffstats
path: root/0022-Pull-dependencies-of-static-libraries-in-CMake-modul.patch
diff options
context:
space:
mode:
Diffstat (limited to '0022-Pull-dependencies-of-static-libraries-in-CMake-modul.patch')
-rw-r--r--0022-Pull-dependencies-of-static-libraries-in-CMake-modul.patch108
1 files changed, 89 insertions, 19 deletions
diff --git a/0022-Pull-dependencies-of-static-libraries-in-CMake-modul.patch b/0022-Pull-dependencies-of-static-libraries-in-CMake-modul.patch
index d7b6a73cb47..fc9e517eca8 100644
--- a/0022-Pull-dependencies-of-static-libraries-in-CMake-modul.patch
+++ b/0022-Pull-dependencies-of-static-libraries-in-CMake-modul.patch
@@ -1,4 +1,4 @@
-From 7f561d87a70af23d5d2a0c89e08ba5744b2f9585 Mon Sep 17 00:00:00 2001
+From b2d749f5e3b7b6d35345dff54c7eb76d2e1a3a44 Mon Sep 17 00:00:00 2001
From: Martchus <martchus@gmx.net>
Date: Sun, 18 Sep 2016 18:32:00 +0200
Subject: [PATCH 22/34] Pull dependencies of static libraries in CMake modules
@@ -7,18 +7,78 @@ When doing a static build of Qt, the dependencies of the Qt
libraries and plugins itself must be specified when linking
the final application.
---
- .../data/cmake/Qt5BasicConfig.cmake.in | 148 ++++++++++++++----
+ .../data/cmake/Qt5BasicConfig.cmake.in | 207 +++++++++++++++---
.../data/cmake/Qt5PluginTarget.cmake.in | 11 +-
qmake/generators/makefile.cpp | 16 +-
- 3 files changed, 133 insertions(+), 42 deletions(-)
+ 3 files changed, 192 insertions(+), 42 deletions(-)
diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
-index 3ed6dd5889..15d8b8372e 100644
+index 3ed6dd5889..9325bb3190 100644
--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
-@@ -49,35 +49,52 @@ but not all the files it references.
+@@ -48,36 +48,110 @@ but not all the files it references.
+ endif()
endmacro()
++!!IF !isEmpty(CMAKE_STATIC_TYPE)
++if(NOT COMMAND _qt5_add_dependencies)
++ # add dependencies via imported targets with their absolute file path so CMake does not mess with them
++ macro(_qt5_add_dependencies IMPORTED_TARGET_NAME IMPORTED_TARGET_CONFIG STATIC_DEPENDENCIES)
++ # prefer static libs
++ set(DEFAULT_CMAKE_FIND_LIBRARY_SUFFIXES \"${CMAKE_FIND_LIBRARY_SUFFIXES}\")
++ set(DEFAULT_CMAKE_FIND_LIBRARY_PREFIXES \"${CMAKE_FIND_LIBRARY_PREFIXES}\")
++ set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib)
++ set(CMAKE_FIND_LIBRARY_PREFIXES lib \"\")
++
++ set(DEPENDENCY_INDEX 0)
++ unset(EXTRA_PATHS)
++ unset(DEPENDENCY_TARGETS)
++
++ foreach(LIBRARY_NAME ${STATIC_DEPENDENCIES})
++ if (TARGET \"${LIBRARY_NAME}\")
++ list(APPEND DEPENDENCY_TARGETS \"${LIBRARY_NAME}\")
++ continue()
++ endif()
++ set(DEPENDENCY_NAME ${IMPORTED_TARGET_NAME}_DEPENDENCY_${DEPENDENCY_INDEX})
++ if (NOT TARGET \"${DEPENDENCY_NAME}\")
++ if(EXISTS \"${LIBRARY_NAME}\")
++ set(IMPORTED_LOCATION ${LIBRARY_NAME})
++ elseif(\"${LIBRARY_NAME}\" MATCHES \" *-l(.*)\")
++ set(LIBRARY_NAME \"${CMAKE_MATCH_1}\")
++ find_library(\"${DEPENDENCY_NAME}_LIBRARY_PATH\" \"${LIBRARY_NAME}\" PATHS \"${EXTRA_PATHS}\")
++ if (NOT EXISTS "${${DEPENDENCY_NAME}_LIBRARY_PATH}")
++ message(WARNING \"Unable to find dependency ${LIBRARY_NAME} for static Qt target (was looking in ${EXTRA_PATHS}).\")
++ continue()
++ endif()
++ set(IMPORTED_LOCATION \"${${DEPENDENCY_NAME}_LIBRARY_PATH}\")
++ elseif(\"${LIBRARY_NAME}\" MATCHES \" *-L(.*)\")
++ list(APPEND EXTRA_PATHS \"${CMAKE_MATCH_1}\")
++ else()
++ set(IMPORTED_LOCATION ${LIBRARY_NAME})
++ message(WARNING \"Format of dependency unknown: ${LIBRARY_NAME}\")
++ endif()
++ add_library(${DEPENDENCY_NAME} STATIC IMPORTED)
++ set_property(TARGET ${DEPENDENCY_NAME} PROPERTY IMPORTED_LOCATION ${IMPORTED_LOCATION})
++ endif()
++ if (TARGET ${DEPENDENCY_NAME})
++ list(APPEND DEPENDENCY_TARGETS ${DEPENDENCY_NAME})
++ endif()
++ math(EXPR DEPENDENCY_INDEX \"${DEPENDENCY_INDEX} + 1\")
++ endforeach()
++
++ if (\"${IMPORTED_TARGET_CONFIG}\" STREQUAL \"ALL\")
++ set_property(TARGET ${IMPORTED_TARGET_NAME} PROPERTY INTERFACE_LINK_LIBRARIES ${DEPENDENCY_TARGETS})
++ else()
++ set_property(TARGET ${IMPORTED_TARGET_NAME} PROPERTY INTERFACE_LINK_LIBRARIES_${IMPORTED_TARGET_CONFIG} ${DEPENDENCY_TARGETS})
++ endif()
++
++ # restore previous setup
++ set(CMAKE_FIND_LIBRARY_SUFFIXES \"${DEFAULT_CMAKE_FIND_LIBRARY_SUFFIXES}\")
++ set(CMAKE_FIND_LIBRARY_PREFIXES \"${DEFAULT_CMAKE_FIND_LIBRARY_PREFIXES}\")
++ endmacro()
++endif()
++!!ENDIF
++
!!IF !equals(TEMPLATE, aux)
-macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION)
- set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
@@ -38,14 +98,12 @@ index 3ed6dd5889..15d8b8372e 100644
+ set(_list_sep \";\")
+ endif()
+ set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
-+ \"INTERFACE_LINK_LIBRARIES_${TARGET_CONFIG}\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}${_list_sep}${_Qt5$${CMAKE_MODULE_NAME}_STATIC_${TARGET_CONFIG}_LIB_DEPENDENCIES}\"
+ \"IMPORTED_LOCATION_${TARGET_CONFIG}\" ${imported_location}
+!!IF !isEmpty(CMAKE_LIB_SONAME)
+ \"IMPORTED_SONAME_${TARGET_CONFIG}\" \"$${CMAKE_LIB_SONAME}\"
+!!ENDIF
-+ # For backward compatibility with CMake < 2.8.12
-+ \"IMPORTED_LINK_INTERFACE_LIBRARIES_${TARGET_CONFIG}\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}${_list_sep}${_Qt5$${CMAKE_MODULE_NAME}_STATIC_${TARGET_CONFIG}_LIB_DEPENDENCIES}\"
+ )
++ _qt5_add_dependencies(Qt5::$${CMAKE_MODULE_NAME} \"${TARGET_CONFIG}\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}${_list_sep}${_Qt5$${CMAKE_MODULE_NAME}_STATIC_${TARGET_CONFIG}_LIB_DEPENDENCIES}\")
+!!ELSE
set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
- \"INTERFACE_LINK_LIBRARIES\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
@@ -77,7 +135,7 @@ index 3ed6dd5889..15d8b8372e 100644
)
endif()
!!ENDIF
-@@ -217,13 +234,47 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+@@ -217,13 +291,45 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!IF !isEmpty(CMAKE_STATIC_TYPE)
add_library(Qt5::$${CMAKE_MODULE_NAME} STATIC IMPORTED)
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY IMPORTED_LINK_INTERFACE_LANGUAGES "CXX")
@@ -98,19 +156,17 @@ index 3ed6dd5889..15d8b8372e 100644
+ file(STRINGS "${PRL_FILE_LOCATION}" prl_strings REGEX "QMAKE_PRL_LIBS_FOR_CMAKE")
+ string(REGEX REPLACE \"QMAKE_PRL_LIBS_FOR_CMAKE *= *([^\n]*)\" \"\\\\1\" static_depends ${prl_strings})
+ string(REGEX REPLACE \"\\\\$\\\\$\\\\[QT_INSTALL_LIBS\\\\]\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/lib\" static_depends \"${static_depends}\")
-+ set_property(TARGET ${PLUGIN_TARGET_NAME} PROPERTY
-+ INTERFACE_LINK_LIBRARIES ${static_depends}
-+ )
++ _qt5_add_dependencies(\"${PLUGIN_TARGET_NAME}\" ALL \"${static_depends}\")
+ endmacro()
+
+!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+ _process_prl_file(\"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_DEBUG}\" DEBUG)
- !!ELSE
++!!ELSE
+ _process_prl_file(\"$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_DEBUG}\" DEBUG)
+!!ENDIF
+!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+ _process_prl_file(\"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_RELEASE}\" RELEASE)
-+!!ELSE
+ !!ELSE
+ _process_prl_file(\"$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_RELEASE}\" RELEASE)
+!!ENDIF
+
@@ -126,7 +182,7 @@ index 3ed6dd5889..15d8b8372e 100644
!!IF !equals(TEMPLATE, aux)
!!IF !isEmpty(CMAKE_BUILD_IS_FRAMEWORK)
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY FRAMEWORK 1)
-@@ -238,6 +289,56 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+@@ -238,6 +344,56 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY INTERFACE_QT_ENABLED_FEATURES $$join(QT.$${MODULE}.enabled_features, ";"))
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY INTERFACE_QT_DISABLED_FEATURES $$join(QT.$${MODULE}.disabled_features, ";"))
@@ -183,7 +239,21 @@ index 3ed6dd5889..15d8b8372e 100644
set(_Qt5$${CMAKE_MODULE_NAME}_PRIVATE_DIRS_EXIST TRUE)
foreach (_Qt5$${CMAKE_MODULE_NAME}_PRIVATE_DIR ${Qt5$${CMAKE_MODULE_NAME}_OWN_PRIVATE_INCLUDE_DIRS})
if (NOT EXISTS ${_Qt5$${CMAKE_MODULE_NAME}_PRIVATE_DIR})
-@@ -328,9 +429,11 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+@@ -256,9 +412,13 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+ list(APPEND _Qt5$${CMAKE_MODULE_NAME}_PRIVATEDEPS ${dep}Private)
+ endif()
+ endforeach()
++!!IF !isEmpty(CMAKE_STATIC_TYPE)
++ _qt5_add_dependencies(Qt5::$${CMAKE_MODULE_NAME}Private ALL \"Qt5::$${CMAKE_MODULE_NAME};${_Qt5$${CMAKE_MODULE_NAME}_PRIVATEDEPS}\")
++!!ELSE
+ set_property(TARGET Qt5::$${CMAKE_MODULE_NAME}Private PROPERTY
+ INTERFACE_LINK_LIBRARIES Qt5::$${CMAKE_MODULE_NAME} ${_Qt5$${CMAKE_MODULE_NAME}_PRIVATEDEPS}
+ )
++!!ENDIF // CMAKE_STATIC_TYPE
+ endif()
+
+ !!IF !equals(TEMPLATE, aux)
+@@ -328,9 +488,11 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!ELSE
\"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
!!ENDIF
@@ -197,7 +267,7 @@ index 3ed6dd5889..15d8b8372e 100644
!!ENDIF // CMAKE_RELEASE_TYPE
!!ENDIF // CMAKE_FIND_OTHER_LIBRARY_BUILD
-@@ -341,29 +444,6 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+@@ -341,29 +503,6 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
)
!!ENDIF // TEMPLATE != aux
@@ -251,7 +321,7 @@ index 5baf0fdb10..ec5f3cc437 100644
+
+endif()
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
-index fc7f729ae6..095b4d2720 100644
+index a802c645c7..30756d9b64 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -1019,10 +1019,18 @@ MakefileGenerator::writePrlFile(QTextStream &t)
@@ -278,5 +348,5 @@ index fc7f729ae6..095b4d2720 100644
}
--
-2.20.1
+2.21.0