I'm working on a existent project that use CMake to configure and generate. The target is an ARM device, so I build all the system with Yocto/OpenEmbedded.
I manage to build a recipe to build the cmake project. It looks like that:
DESCRIPTION = "FANN LIB"
LICENSE = "CLOSED"
inherit cmake
SRCREV = "${AUTOREV}"
PV = "1.0"
SRC_URI = "git://github.com/libfann/fann.git;branch=master;protocol=git"
S = "${WORKDIR}/git"
BBCLASSEXTEND = "native"
FILES_${PN} += "/usr/lib/cmake/"
In the code there are "#ifdef DEBUG" that I would like to activate. So I would like to add DEBUG to the C/C++ Flags.
I found that I could use
EXTRA_OECMAKE += "CXXFLAGS='-DDEBUG'"
EXTRA_OECMAKE = "set(CMAKE_CXX_FLAGS "-DDEBUG")"
But both replace all CFlags and that is not what I want (plus it broke compilation!)
I just would like that -DDEBUG is added when calling the compiler! :-)
How can I add a preprocessor definition in a CMake based project in a Yocto recipe?