Skip to content

Commit

Permalink
Merge pull request #379 from azeey/2_to_3
Browse files Browse the repository at this point in the history
Merge ign-cmake2 ➡️  gz-cmake3
  • Loading branch information
azeey authored Aug 23, 2023
2 parents 93c2059 + f4f88c4 commit ac97ec5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
25 changes: 9 additions & 16 deletions cmake/FindGzOGRE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,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)
GZ_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)
Expand Down Expand Up @@ -148,22 +145,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)
GZ_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()

gz_pkg_config_library_entry(GzOGRE 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
Expand Down
9 changes: 4 additions & 5 deletions cmake/FindGzOGRE2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,12 @@ if (NOT WIN32)

# use pkg-config to find ogre plugin path
# do it here before resetting the pkg-config paths
execute_process(COMMAND pkg-config --variable=plugindir ${GZ_PKG_NAME}
OUTPUT_VARIABLE _pkgconfig_invoke_result
RESULT_VARIABLE _pkgconfig_failed)
if(_pkgconfig_failed)
pkg_get_variable(OGRE2_PLUGINDIR ${GZ_PKG_NAME} plugindir)

if(NOT OGRE2_PLUGINDIR)
GZ_BUILD_WARNING ("Failed to find OGRE's plugin directory. The build will succeed, but there will likely be run-time errors.")
else()
fix_pkgconfig_prefix_jammy_bug("${_pkgconfig_invoke_result}" OGRE2_PLUGINDIR)
fix_pkgconfig_prefix_jammy_bug("${OGRE2_PLUGINDIR}" OGRE2_PLUGINDIR)
endif()

# reset pkg config path
Expand Down

0 comments on commit ac97ec5

Please sign in to comment.