Ask Your Question

Setting CFLAGS and CXXFLAGS for OpenCV 2.4.3

asked 2012-12-05 15:56:40 -0600

Will gravatar image

I have been able to, in the past, set the compiler options via the command-line like this:

CXXFLAGS="-O2 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp" CFLAGS="-O2 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp" cmake -DCMAKE_TOOLCHAIN_FILE=~/src/arm-toolchain.cmake ..

However, as of OpenCV 2.4.3 the CMake scripts seem to be actively ignoring/resetting the user specified CFLAGS. Is there a way around this I'm not seeing, or should I file a bug report?

Thanks for the help!

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-02-05 04:03:18 -0600

Angeloc gravatar image

Opencv is based on CMake, so if you want to change compiler flags, you should edit the CMakeLists.txt file, setting the EXTRA_C_FLAGS property this way:

set(EXTRA_C_FLAGS "-mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp")
edit flag offensive delete link more


Hello, thanks for your answer. By the way, do I need to set CXX_FLAGS like this: set(EXTRA_CXX_FLAGS "-mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp")


EstaWang gravatar imageEstaWang ( 2013-04-12 22:28:46 -0600 )edit

answered 2015-07-25 17:47:50 -0600

JVorwald gravatar image

In CMake, add two new boolean variables and leave them unchecked (off).

edit flag offensive delete link more

Question Tools


Asked: 2012-12-05 15:56:40 -0600

Seen: 5,031 times

Last updated: Feb 05 '13