View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006973CMakeModulespublic2008-05-07 03:032009-02-23 22:39
ReporterChristian Ehrlicher 
Assigned ToPhilip Lowman 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake-2-6 
Target VersionFixed in VersionCMake-2-6 
Summary0006973: Consolidate Findosg*
DescriptionI know Findosg*.cmake are only contributed by the osg devs but it would be nice to consolidate them like FindQt4.cmake. Currently I have to add a find_package() every single osg lib. Also there's not OSG_LIBRARIES var with all osg libs so I have to do it by my own / have to add all libs to every lib/app I create.
Maybe ask the osg devs and help them out to make Findosg* more useable.
TagsNo tags attached.
Attached Files? file icon FindOpenSceneGraph.cmake [^] (2,107 bytes) 2009-01-23 01:45

 Relationships

  Notes
(0011784)
Philip Lowman (developer)
2008-05-09 14:18

I have no major issue with doing a FIND_PACKAGE() for all of the OSG node kits that I'm using. My biggest issue with the built in packages is that they don't find the MSVC debugged versions of the libraries if you're using MSVC so I have to get around this with a bit of a hack right now.


#
# A wrapper for TARGET_LINK_LIBRARIES() which lets the MPV link against
# MSVC debug libraries of the OSG when applicable and also warn users
# when they are missing.
#
MACRO(MPV_TARGET_LINK_OSG_LIBRARIES _target)
    IF(MSVC)
        FOREACH(_lib ${ARGN})
            IF(EXISTS ${_lib})
                # do a simple string replacement to obtain the debugged libname
                STRING(REPLACE ".lib" "d.lib" _libd ${_lib})
                IF(NOT EXISTS ${_libd})
                    SET(_MPV_warn_msvc_user true)
                ELSE()
                    TARGET_LINK_LIBRARIES(${_target} debug ${_libd})
                ENDIF()
            ENDIF()
            TARGET_LINK_LIBRARIES(${_target} optimized ${_lib})
        ENDFOREACH()

        IF(_MPV_warn_msvc_user AND NOT _MPV_have_warned_msvc_user)
            MESSAGE("WARNING: You do not have debug libraries of the OSG built
            (osgd.lib, etc.)! Until you provide these debug libraries you
            will not be able to build a Debug build of the MPV. Click OK to
            acknowledge this.")
            SET(_MPV_have_warned_msvc_user true CACHE INTERNAL "")
        ENDIF()
    ELSE()
        TARGET_LINK_LIBRARIES(${_target} ${ARGN})
    ENDIF()
ENDMACRO()
(0014674)
Christian Ehrlicher (reporter)
2009-01-23 01:46

I don't understand the problem here - wyh can't you use the cmake-provided 'debug' and 'release' keywords here like it's done in FindQt4.cmake. Searching for the debug version is done in kde4 with a helper macro ( http://websvn.kde.org/trunk/KDE/kdelibs/cmake/modules/FindLibraryWithDebug.cmake [^] ). It's not very nice but it works fine for all our libs which have a debug prefix.

I've uploaded a FindOpenSceneGraph.cmake from me which works fine on Linux and Windows if you want to take a look :)
(0014675)
Philip Lowman (developer)
2009-01-23 02:29

The new modules I checked into CVS a couple of days ago use the debug & release keywords. My complaint from 2008-05-09 was basically about the lack of debug & release support. :)

As for a consolidated FindOpenSceneGraph.cmake I'm working on one at the moment as well. Unfortunately we can't remove all of the various Findosg.cmake, FindosgDB.cmake, etc. modules from CMake but we can make a FindOpenSceneGraph.cmake include them as desired so they are at least reused.

Rather than assuming the user wants to use every nodekit in existence (which is definitely not the case where I work), I'm inclined more towards adding something like this:

FIND_PACKAGE(OpenSceneGraph 2.0.0 REQUIRED osgDB osgUtil osgSim)
INCLUDE_DIRECTORIES(${OPENSCENEGRAPH_INCLUDE_DIRS})

ADD_EXECUTABLE(foo foo.cc)
TARGET_LINK_LIBRARIES(foo ${OPENSCENEGRAPH_LIBRARIES})

The user would need to define libraries in addition to "osg" and "OpenThreads" that they want to use, but the plus side is they would only have to do this on one line. Also there would be no ambiguous question regarding what to do if the user links against an older version of OSG that may not have a nodekit they need, like osgAnimation or osgShadow. If they specify osgAnimation in the REQUIRED line and it's not there simply issue a FATAL_ERROR.

The current means of doing the above (in latest CVS) is cumbersome and there is no version support.

FIND_PACKAGE(osg REQUIRED)
FIND_PACKAGE(osgDB REQUIRED)
FIND_PACKAGE(osgUtil REQUIRED)
FIND_PACKAGE(osgSim REQUIRED)
FIND_PACKAGE(OpenThreads REQUIRED)

INCLUDE_DIRECTORIES(${OSG_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${OSGDB_INCLUDE_DIR}) # probably not needed unless an external library is being used
...

TARGET_LINK_LIBRARIES(foo ${OSG_LIBRARIES} ${OSGDB_LIBRARIES} ${OSGUTIL_LIBRARIES} ${OSGSIM_LIBRARIES} ${OPENTHREADS_LIBRARIES})
(0014676)
Christian Ehrlicher (reporter)
2009-01-23 03:11

Good idea - cmake 2.6.x wasn't available while I wrote the initial version therefore I couldn't use the new possiblities :)
(0014744)
Philip Lowman (developer)
2009-01-30 20:23

Checked a new FindOpenSceneGraph.cmake into CVS, see the documentation for details. It will be in CMake 2.6.3.



If you have any further suggestions please post to the mailing list or open additional feature requests / bugs.
(0015303)
Philip Lowman (developer)
2009-02-23 22:39

Implemented in CMake 2.6.3

 Issue History
Date Modified Username Field Change
2008-05-07 03:03 Christian Ehrlicher New Issue
2008-05-07 08:15 Bill Hoffman Status new => assigned
2008-05-07 08:15 Bill Hoffman Assigned To => Eric Wing
2008-05-09 14:18 Philip Lowman Note Added: 0011784
2009-01-23 00:55 Philip Lowman Category CMake => Modules
2009-01-23 01:45 Christian Ehrlicher File Added: FindOpenSceneGraph.cmake
2009-01-23 01:46 Christian Ehrlicher Note Added: 0014674
2009-01-23 02:29 Philip Lowman Note Added: 0014675
2009-01-23 03:11 Christian Ehrlicher Note Added: 0014676
2009-01-30 20:23 Philip Lowman Note Added: 0014744
2009-01-30 20:23 Philip Lowman Assigned To Eric Wing => Philip Lowman
2009-01-30 20:23 Philip Lowman Status assigned => resolved
2009-01-30 20:23 Philip Lowman Resolution open => fixed
2009-02-23 22:39 Philip Lowman Note Added: 0015303
2009-02-23 22:39 Philip Lowman Status resolved => closed
2009-02-23 22:39 Philip Lowman Fixed in Version => CMake-2-6


Copyright © 2000 - 2018 MantisBT Team