0

I have some OpenCV/C++ application which compiles with a CMake definitions file, in which I did not find a way to pass flags to the compiler.

I know that there are the flags C_INCLUDE_PATH CPLUS_INCLUDE_PATH, and all the rest of their friends...

But, is there an environment variable for definition of any other flags, in which I'd be able to define -std=c++11 ?

SomethingSomething
  • 10,344
  • 14
  • 61
  • 112
  • Does [this question](http://stackoverflow.com/questions/10851247/how-to-activate-c-11-in-cmake) solve your issue? – TartanLlama Mar 24 '16 at 09:49

2 Answers2

1

The easiest but certainly not nicest solution if you want to force it by hand would be:

add_compile_options(-std=c++11)

However CMake should be able to pick the necessary standard for you. Have a look to this answer: How to detect c++11 support of a compiler with cmake

Community
  • 1
  • 1
Stefano
  • 3,889
  • 8
  • 32
  • 64
1

If you're using CMake, equally easy and nicer solution will be to pass

-DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=ON

to CMake.

mfolusiak
  • 111
  • 1
  • 4