How to set cmake_CXX_flags [closed]
Hi all,
I'm trying to implement a node for acquire images with Gstreamer.
I had a monolitic application which did that. Now I reimplemented it in a node. The problem is that the old application is 3 time faster. I suppose that the problem comes from the CMake file and the optimizations. Indeed in the Makefile of the old application there are the following lines:
CFLAGS_OPENCV = -I/usr/include/opencv
CFLAGS_GLIBS = -I/usr/include/glib-2.0/glib -I/usr/include/glib-2.0
-I/usr/lib/i386-linux-gnu/glib-2.0/include
CFLAGS_GSTREAMER= $(CFLAGS_GLIBS) -I/usr/include -I/usr/include/gstreamer-0.10
-I/usr/include/gstreamer-0.10/gst/ -I/usr/include/glib-2.0 -I/usr/lib/glib-
2.0/include -I/usr/include/libxml2 -I/lib -I/usr/local/lib -I/usr/lib -I/usr
/lib/include/gstreamer-0.10/gst/video
-I/usr/lib/include/gstreamer-0.10/gst/signalprocessor
-I/usr/lib/include/gstreamer-0.10/gst/interfaces
CFLAGS = $(CFLAGS_OPENCV) $(CFLAGS_GSTREAMER)
CXXFLAGS = $(CFLAGS) -O2 -g -Wall -fmessage-length=0
How can I set these flags in the CMakeList.txt? Currently this is part of my CMakeList.txt:
include_directories(/usr/include/gstreamer-0.10 /usr/include/glib-2.0
/usr/lib/glib-2.0/include /usr/lib/i386-linux-gnu/glib-2.0/include
/usr/lib/x86_64-linux-gnu/glib-2.0/include /usr/include/libxml2)
set(CMAKE_CXX_FLAGS "-O2 -g -Wall -fmessage-length=0")
rosbuild_add_executable(mainCamera mainCamera.cpp)
rosbuild_add_compile_flags(mainCamera "-O2 -g -Wall -fmessage-length=0")
target_link_libraries(mainCamera ${OROCOS-RTT_RTT-MARSHALLING_LIBRARY} gstreamer-0.10 gstbase-0.10
gobject-2.0 gmodule-2.0 gthread-2.0 rt xml2 glib-2.0 gstapp-0.10 pthread)
Thanks!
First question: does gscam (http://ros.org/wiki/gscam) not do what you want?