diff options
Diffstat (limited to 'cmake/QtPkgConfigHelpers.cmake')
-rw-r--r-- | cmake/QtPkgConfigHelpers.cmake | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/cmake/QtPkgConfigHelpers.cmake b/cmake/QtPkgConfigHelpers.cmake index 21a09365f2..ea28516941 100644 --- a/cmake/QtPkgConfigHelpers.cmake +++ b/cmake/QtPkgConfigHelpers.cmake @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + function(qt_internal_collect_direct_target_dependencies target targets_out_var) __qt_internal_walk_libs("${target}" "${targets_out_var}" _rcc_objects "qt_direct_targets_dict" "direct_targets") @@ -19,7 +22,8 @@ endmacro() # Create a Qt6*.pc file intended for pkg-config consumption. function(qt_internal_generate_pkg_config_file module) # TODO: PkgConfig is supported under MSVC with pkgconf (github.com/pkgconf/pkgconf) - if((NOT UNIX OR QT_FEATURE_framework) AND NOT MINGW OR CMAKE_VERSION VERSION_LESS "3.20") + if((NOT UNIX OR QT_FEATURE_framework) + AND NOT MINGW OR CMAKE_VERSION VERSION_LESS "3.20" OR ANDROID) return() endif() if(NOT BUILD_SHARED_LIBS) @@ -47,6 +51,17 @@ function(qt_internal_generate_pkg_config_file module) list(TRANSFORM loose_include_dirs REPLACE "${INSTALL_INCLUDEDIR}" "\${includedir}") list(TRANSFORM loose_include_dirs REPLACE "${INSTALL_MKSPECSDIR}" "\${mkspecsdir}") + # Remove genex wrapping around gc_sections flag because we can't evaluate genexes like + # $<CXX_COMPILER_ID> in file(GENERATE). And given that .pc files don't support dynamic + # evaluation like the $<CXX_COMPILER_ID> genex, distros will be expected to patch the .pc + # files according to which compiler they intend to be used with. + get_property(gc_sections_with_genex GLOBAL PROPERTY _qt_internal_gc_sections_with_genex) + get_property(gc_sections_without_genex GLOBAL PROPERTY _qt_internal_gc_sections_without_genex) + if(loose_link_options AND gc_sections_with_genex AND gc_sections_without_genex) + string(REPLACE "${gc_sections_with_genex}" "${gc_sections_without_genex}" + loose_link_options "${loose_link_options}") + endif() + qt_internal_set_pkg_config_cpp_flags(link_options "${loose_link_options}" "") qt_internal_set_pkg_config_cpp_flags(compile_defs "${loose_compile_defs}" -D) qt_internal_set_pkg_config_cpp_flags(include_dirs "${loose_include_dirs}" -I) @@ -59,7 +74,7 @@ function(qt_internal_generate_pkg_config_file module) foreach(dep IN LISTS loose_target_requires) if(dep MATCHES "^Qt::") string(REGEX REPLACE "Qt" "${QT_CMAKE_EXPORT_NAMESPACE}" dep ${dep}) - else() + elseif(NOT dep MATCHES "^${QT_CMAKE_EXPORT_NAMESPACE}::") # TODO: Figure out a way to get non-Qt requirements PkgConfig files. continue() endif() |