Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
if (NOT OGRE_SOURCE) # If using ogre sources, use the target names instead of library files to link.
find_library(OGRE_LIBRARY_REL NAMES ${OGRE_LIBRARY_NAMES} HINTS ${OGRE_LIB_SEARCH_PATH} ${OGRE_PKGC_LIBRARY_DIRS} ${OGRE_FRAMEWORK_SEARCH_PATH} PATH_SUFFIXES "" "Release" "RelWithDebInfo" "MinSizeRel")
find_library(OGRE_LIBRARY_DBG NAMES ${OGRE_LIBRARY_NAMES_DBG} HINTS ${OGRE_LIB_SEARCH_PATH} ${OGRE_PKGC_LIBRARY_DIRS} ${OGRE_FRAMEWORK_SEARCH_PATH} PATH_SUFFIXES "" "Debug")
else()
if( NOT OGRE_LIBRARIES OR OGRE_LIBRARIES STREQUAL "" )
message( FATAL_ERROR "When using Ogre from sources, please specify target names in OGRE_LIBRARIES!" )
else()
message( "Using Ogre source instead of binary libraries - skipping library files search." )
endif()
endif()
What is the purpose of that? It seems either broken or incomplete.
What I would like to be able to do is have CMake find a copy of Ogre that I have built but not installed. This is what I thought that the variables OGRE_BUILD and OGRE_SOURCE are for, at least that worked in 1.8. OGRE_SOURCE so it can find the headers and OGRE_BUILD so it can find the built libraries. If I remove the if clause (and add macosx to the search path) then it is able to find them.
Last edited by glennr on Thu Feb 06, 2014 11:01 pm, edited 1 time in total.
However, I'm not a CMake expert and I still find it problematic as soon as I try to work with dependencies. So maybe I misunderstood an idiomatic or just better way to avoid these problems (which seems to be the same problem than what you describe).
Maybe it's just incomplete as you said. My current understanding of the problem is limited to what I described in the pull request.
Ok, I sort of get it, but not fully. In any case I think your fix needs some amendment because it breaks the intended use of the OGRE_SOURCE variable. This comment in FindOGRE.cmake implies that this variable is used to find Ogre when it has been built from source, rather than an installed version.
As long as it allows me to use Ogre sources directly as described in the comments of the PR, adding a variable for this case would be perfectly fine for me. I can't work on this though so if you could setup this and make a PR I could maybe find time to test it sometime this week or the coming week end.
Would it suffice to add a variable named OGRE_DONT_FIND_LIBS and use that, instead of NOT OGRE_SOURCE to disable find_library for your use case? So you would just need to set that in your CMakeLists.txt before calling find_package( OGRE ).