[ignition-cmake2] fix pkgconfig usage for finding OGRE (#32987)

This commit is contained in:
RobbertProost 2023-08-08 20:34:06 +02:00 коммит произвёл GitHub
Родитель 0e20c30315
Коммит 90e7eab1a9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 61 добавлений и 3 удалений

Просмотреть файл

@ -0,0 +1,52 @@
diff --git a/cmake/FindIgnOGRE.cmake b/cmake/FindIgnOGRE.cmake
index e00f619..6825eb2 100644
--- a/cmake/FindIgnOGRE.cmake
+++ b/cmake/FindIgnOGRE.cmake
@@ -99,15 +99,12 @@ if (NOT WIN32)
set (OGRE_FOUND false)
else ()
# set library dirs if the value is empty
- if (NOT ${OGRE_LIBRARY_DIRS} OR ${OGRE_LIBRARY_DIRS} STREQUAL "")
- execute_process(COMMAND pkg-config --variable=libdir OGRE
- OUTPUT_VARIABLE _pkgconfig_invoke_result
- RESULT_VARIABLE _pkgconfig_failed)
- if(_pkgconfig_failed)
+ if (NOT OGRE_LIBRARY_DIRS)
+ pkg_get_variable(OGRE_LIBRARY_DIRS OGRE libdir)
+ if(NOT OGRE_LIBRARY_DIRS)
IGN_BUILD_WARNING ("Failed to find OGRE's library directory. The build will succeed, but there will likely be run-time errors.")
else()
- # set ogre library dir and strip line break
- set(OGRE_LIBRARY_DIRS ${_pkgconfig_invoke_result})
+ # strip line break
string(REGEX REPLACE "\n$" "" OGRE_LIBRARY_DIRS "${OGRE_LIBRARY_DIRS}")
string(FIND "${OGRE_LIBRARIES}" "${OGRE_LIBRARY_DIRS}" substr_found)
@@ -147,22 +144,18 @@ if (NOT WIN32)
endif()
endforeach()
- execute_process(COMMAND pkg-config --variable=plugindir OGRE
- OUTPUT_VARIABLE _pkgconfig_invoke_result
- RESULT_VARIABLE _pkgconfig_failed)
- if(_pkgconfig_failed)
+ pkg_get_variable(OGRE_PLUGINDIR OGRE plugindir)
+ if(NOT OGRE_PLUGINDIR)
IGN_BUILD_WARNING ("Failed to find OGRE's plugin directory. The build will succeed, but there will likely be run-time errors.")
else()
- # This variable will be substituted into cmake/setup.sh.in
- set(OGRE_PLUGINDIR ${_pkgconfig_invoke_result})
+ # Seems that OGRE_PLUGINDIR can end in a newline, which will cause problems
+ # when we pass it to the compiler later.
+ string(REPLACE "\n" "" OGRE_PLUGINDIR ${OGRE_PLUGINDIR})
endif()
ign_pkg_config_library_entry(IgnOGRE OgreMain)
set(OGRE_RESOURCE_PATH ${OGRE_PLUGINDIR})
- # Seems that OGRE_PLUGINDIR can end in a newline, which will cause problems
- # when we pass it to the compiler later.
- string(REPLACE "\n" "" OGRE_RESOURCE_PATH ${OGRE_RESOURCE_PATH})
endif()
#reset pkg config path

Просмотреть файл

@ -4,7 +4,8 @@ ignition_modular_library(NAME cmake
VERSION ${PACKAGE_VERSION}
SHA512 6ee64ff6c82c657678188be459c50a4255fd3881d758906d93361425702d04854a13a46124b20e058069f314077ba7e6c15a058153b615b3245084f066d1cbae
PATCHES
add-pkgconfig-and-remove-privatefor-limit.patch)
add-pkgconfig-and-remove-privatefor-limit.patch
fix-findogre-pkgconfig.patch)
# Install custom usage
configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" @ONLY)

Просмотреть файл

@ -1,7 +1,7 @@
{
"name": "ignition-cmake2",
"version": "2.16.0",
"port-version": 1,
"port-version": 2,
"description": "CMake helper functions for building robotic applications",
"homepage": "https://ignitionrobotics.org/libs/cmake",
"license": null,

Просмотреть файл

@ -3278,7 +3278,7 @@
},
"ignition-cmake2": {
"baseline": "2.16.0",
"port-version": 1
"port-version": 2
},
"ignition-common1": {
"baseline": "1.1.1",

Просмотреть файл

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "b27712039b4d79cf56407894ede3681292712649",
"version": "2.16.0",
"port-version": 2
},
{
"git-tree": "fefe057cb14c0f698b0ebb1a717b5bba189ab355",
"version": "2.16.0",