[osg-users] CMake - How to configure a library using OSG

Vincent Bourdier vincent.bourdier at gmail.com
Mon Apr 4 12:33:27 PDT 2011


Hi everybody,

I'm working a library as a toolbox based on OSG.
I'm trying to write a CMake configuration file.

The file is working, OSG is found, but OSG needs two includes directories :

D:\Codage\OSG_2.8.2\binaries\include;
D:\Codage\OSG_2.8.2\sources\src\include;

And Cmake generate a Visual Studio 2008 project with only the
"sources/src/include" directory... so the project do not compil.

How can I change that to have the good include directories ?

I join my CmakeLists.txt configuration file, if it can help....

Thanks for your help.

Regards,
    Vincent.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20110404/6343cc16/attachment-0002.htm>
-------------- next part --------------
cmake_minimum_required(VERSION 2.6)

#set the name of the project
SET(LIBRARYNAME Hud)


#Déclaration du projet
project(${LIBRARYNAME})

#Repertoire de sortie des compilations
set(LIBRARY_OUTPUT_PATH lib)


#inclusion d'OSG et OpenThreads
FIND_PACKAGE(OpenThreads)
FIND_PACKAGE(OpenSceneGraph 2.8.0 REQUIRED QUIET COMPONENTS osg osgDB osgUtil osgGA osgText osgFX osgViewer)

#ajout des includes des libs dans les paths d'include
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS})
include_directories(${OPENTHREADS_INCLUDE_DIRS})

#Do not forget its own includes
include_directories("src")


#Génération de la liste des fichiers header
file(
	GLOB_RECURSE
	header_source_files
	src/*.h
)
#Génération de la liste des fichiers cpp
file(
	GLOB_RECURSE
	cpp_source_files
	src/*.cpp
)


#Déclaration de la lib
add_library(
	${LIBRARYNAME}
	SHARED
	${cpp_source_files} ${header_source_files}
)

#ajout des libs au linker
target_link_libraries(
	${LIBRARYNAME}
	${OPENTHREADS_LIBRARIES}
	${OPENSCENEGRAPH_LIBRARIES}
)




More information about the osg-users mailing list