[osg-users] problems with static builds on windos

Stephan Maximilian Huber ratzfatz at digitalmind.de
Fri Oct 26 09:28:24 PDT 2007


Hi

I am trying a static build os osg 2.2 with Visual Studio. I set the 
cmake options, generated the solution files and started the build inside 
VS. The linker could not link the applications (osgviewer etc) because 
it could not find the lib OpenThreadsd.lib (I can only found a 
ot9-openthreadsd.lib) It looks like a mistake in the cmakelist-files.

More important for my own code: I get errors of multiple defined 
symbols, because the osg-libs include the OpenThreads as if they were 
linked dynamically, which is not the case.

I had to modify the CMakeLists-files inside the various src-folders from:


IF   (DYNAMIC_OPENSCENEGRAPH)
    ADD_DEFINITIONS(-DOSGSIM_LIBRARY)
ELSE (DYNAMIC_OPENSCENEGRAPH)
    ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC)
ENDIF(DYNAMIC_OPENSCENEGRAPH)


to

IF   (DYNAMIC_OPENSCENEGRAPH)
    ADD_DEFINITIONS(-DOSGSIM_LIBRARY)
ELSE (DYNAMIC_OPENSCENEGRAPH)
    ADD_DEFINITIONS(-DOT_LIBRARY_STATIC)
    ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC)
ENDIF(DYNAMIC_OPENSCENEGRAPH)

My experience wuth CMake is very limited, so I don't know if these 
changes are ok. Perhaps someone wants to build Openthreads dynamically 
and osg statically, then my hack will not work.

If my changes look sensible, I can submit the new CMakeLists files to 
osg-submissions.

BTW: is there a nicer way to define these compile-flags in a central file?


cheers,
Stephan





More information about the osg-users mailing list