Skip to content

[feature request] Add pc files in static linkage. #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmake/QtBaseGlobalTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -471,3 +471,5 @@ endif()
qt_copy_or_install(FILES
"util/json_schema/modules.json"
DESTINATION "${INSTALL_QT_SHAREDIR}/json_schema/")

qt_internal_generate_pkg_config_file(GlobalConfig)
10 changes: 7 additions & 3 deletions cmake/QtPkgConfigHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ function(qt_internal_generate_pkg_config_file module)
if(NOT UNIX AND NOT MINGW OR CMAKE_VERSION VERSION_LESS "3.20" OR ANDROID)
return()
endif()
if(NOT BUILD_SHARED_LIBS)
return()
endif()

set(pkgconfig_file "${QT_CMAKE_EXPORT_NAMESPACE}${module}")
set(pkgconfig_name "${QT_CMAKE_EXPORT_NAMESPACE} ${module}")
Expand All @@ -46,6 +43,7 @@ function(qt_internal_generate_pkg_config_file module)
get_target_property(loose_link_options ${target} INTERFACE_LINK_OPTIONS)
get_target_property(loose_compile_defs ${target} INTERFACE_COMPILE_DEFINITIONS)
get_target_property(loose_include_dirs ${target} INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(link_libs ${target} LINK_LIBRARIES)
list(TRANSFORM loose_include_dirs REPLACE "${INSTALL_INCLUDEDIR}" "\${includedir}")
list(TRANSFORM loose_include_dirs REPLACE "${INSTALL_MKSPECSDIR}" "\${mkspecsdir}")
if(QT_FEATURE_framework)
Expand Down Expand Up @@ -116,6 +114,12 @@ function(qt_internal_generate_pkg_config_file module)
endforeach()
string(APPEND link_options " $<JOIN:$<REMOVE_DUPLICATES:${target_libs}>, >")

foreach(lib IN LISTS link_libs)
if(lib MATCHES "^-")
list(APPEND link_options "${lib}")
else()
endforeach()

qt_path_join(path_suffix "${INSTALL_LIBDIR}" pkgconfig)
qt_path_join(build_dir "${QT_BUILD_DIR}" "${path_suffix}")
qt_path_join(install_dir "${QT_INSTALL_DIR}" "${path_suffix}")
Expand Down