vcpkg/ports/ignition-cmake2/add-pkgconfig-and-remove-privatefor-limit.patch

49 lines
1.9 KiB
Diff
Raw Normal View History

diff --git a/cmake/IgnUtils.cmake b/cmake/IgnUtils.cmake
index bc6dbdc..1e8adbb 100644
--- a/cmake/IgnUtils.cmake
+++ b/cmake/IgnUtils.cmake
@@ -142,7 +142,7 @@ macro(ign_find_package PACKAGE_NAME)
#------------------------------------
# Define the expected arguments
set(options REQUIRED PRIVATE EXACT QUIET CONFIG BUILD_ONLY PKGCONFIG_IGNORE)
- set(oneValueArgs VERSION PRETTY PURPOSE EXTRA_ARGS PKGCONFIG PKGCONFIG_LIB PKGCONFIG_VER_COMPARISON)
+ set(oneValueArgs VERSION PRETTY PURPOSE EXTRA_ARGS PKGCONFIG PKGCONFIG_LIB PKGCONFIG_VER_COMPARISON BY_PKGCONFIG)
set(multiValueArgs REQUIRED_BY PRIVATE_FOR COMPONENTS OPTIONAL_COMPONENTS)
#------------------------------------
@@ -191,9 +191,15 @@ macro(ign_find_package PACKAGE_NAME)
endif()
+ if (NOT ign_find_package_BY_PKGCONFIG)
#------------------------------------
# Call find_package with the provided arguments
find_package(${${PACKAGE_NAME}_find_package_args})
+ else()
+ find_package(PkgConfig REQUIRED)
+ include(FindPkgConfig)
+ pkg_check_modules(${PACKAGE_NAME} ${ign_find_package_BY_PKGCONFIG})
+ endif()
if(${PACKAGE_NAME}_FOUND)
@@ -319,17 +325,11 @@ macro(ign_find_package PACKAGE_NAME)
endif()
if(ign_find_package_REQUIRED_BY)
-
- # Identify which components are privately requiring this package
- foreach(component ${ign_find_package_PRIVATE_FOR})
- set(${component}_${PACKAGE_NAME}_PRIVATE true)
- endforeach()
-
# If this is required by some components, add it to the
# ${component}_CMAKE_DEPENDENCIES variables that are specific to those
# componenets
foreach(component ${ign_find_package_REQUIRED_BY})
- if(NOT ${component}_${PACKAGE_NAME}_PRIVATE)
+ if(NOT ign_find_package_BY_PKGCONFIG)
ign_string_append(${component}_CMAKE_DEPENDENCIES "${${PACKAGE_NAME}_find_dependency}" DELIM "\n")
endif()
endforeach()