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