[CMake] CFLAGS on CMAKE

Xavier Larrode Xavier.Larrode at irisa.fr
Wed Jul 19 11:52:12 EDT 2006


Hello all,
I would like to build an application with OpenSG and Cmake.
So i keept all cflags and include dir to an OSG_CFLAGS and all libs and 
libdir on an OSG_libs var
To do so i did this :

PROJECT(TestOsg)
# osg-config should be in your path but may be on $OSGROOT
  FIND_PROGRAM(CMAKE_OSG_CONFIG osg-config
      $ENV{OSGROOT}
      . )
# check if osg-config was found
IF(CMAKE_OSG_CONFIG)
  SET(OSG_ARG_CFLAGS "--cflags")
  SET(OSG_ARG_LIBS "--libs")
# evaluate osg-config for cflags
  EXEC_PROGRAM(${CMAKE_OSG_CONFIG}
      ARGS ${OSG_ARG_CFLAGS}
      OUTPUT_VARIABLE OSG_CFLAGS)
# evaluate osg-config for cflags
  EXEC_PROGRAM(${CMAKE_OSG_CONFIG}
      ARGS ${OSG_ARG_LIBS}
      OUTPUT_VARIABLE OSG_LIBS)
SET(CMAKE_CXX_FLAGS "${OSG_CFLAGS}")
#  INCLUDE (${OSG_CFLAGS})
# INCLUDE_DIRECTORIES(${OSG_CFLAGS})
#  ADD_DEFINITIONS(${OSG_CFLAGS})
ELSE(CMAKE_OSG_CONFIG)
  MESSAGE(STATUS "Cannot find osg-config anywhere on the system. Please 
put the file into your path or specify it in CMAKE_OSG_CONFIG.")
ENDIF(CMAKE_OSG_CONFIG)

  ADD_EXECUTABLE(test testCubeTexture.cpp)
#INCLUDE_DIRECTORIES(${OSG_CFLAGS})
TARGET_LINK_LIBRARIES(test ${OSG_LIBS} )

My problem is that the CMAKE_CXX_FLAGS is not used during the compilation.
I tried to put the OSG_CFLAGS with INCLUDE(${OSG_CFLAGS}) but it'not 
allowed as my osg-config --cflags begin by -D...... -I.....

Any idea how to do it ?
Thanks


-------------- next part --------------
A non-text attachment was scrubbed...
Name: Xavier.Larrode.vcf
Type: text/x-vcard
Size: 169 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20060719/11f73656/Xavier.Larrode.vcf


More information about the CMake mailing list