Skip to content

Commit 6a646e9

Browse files
authored
FindIgnOGRE2: prefer versioned component libraries (#125)
Both ogre1.9 and ogre2.1 install component libraries named libOgreOverlay. For ogre1.9, an unversioned symbolic link is installed directly into the lib folder, while in our debian libogre-2.1-dev and brew ogre2.1 packages, an unversioned symbolic link is installed in lib/OGRE-2.1. This find module uses find_library to find Ogre component libraries with HINTS pointing to the lib/OGRE-2.1 subfolder, which is helpful but limited because the CMAKE_PREFIX_PATH is searched before the HINTS. When building ignition-rendering with homebrew, the CMAKE_PREFIX_PATH may include /usr/local, which causes the libOgreOverlay library from ogre1.9 to be found before the version from ogre2.1. On macOS, the following are in /usr/local/lib: /usr/local/lib/libOgreOverlay.1.9.0.dylib /usr/local/lib/libOgreOverlay.2.1.0.dylib /usr/local/lib/libOgreOverlay.dylib (sym-link to 1.9.0) This causes find_library to prefer a library name with the version appended before the suffix, while still accepting unversioned names if a versioned name is not found. Signed-off-by: Steve Peters <scpeters@openrobotics.org>
1 parent a559c57 commit 6a646e9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmake/FindIgnOGRE2.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,11 @@ if (NOT WIN32)
211211
# find ogre components
212212
include(IgnImportTarget)
213213
foreach(component ${IgnOGRE2_FIND_COMPONENTS})
214-
find_library(OGRE2-${component} NAMES "Ogre${component}" HINTS ${OGRE2_LIBRARY_DIRS})
214+
find_library(OGRE2-${component}
215+
NAMES
216+
"Ogre${component}.${OGRE2_VERSION}"
217+
"Ogre${component}"
218+
HINTS ${OGRE2_LIBRARY_DIRS})
215219
if (NOT "OGRE2-${component}" STREQUAL "OGRE2-${component}-NOTFOUND")
216220

217221
# create a new target for each component

0 commit comments

Comments
 (0)