<div dir="ltr">Hi All,<br><div><br></div><div>I'm sure there is a way to do this, but I'm not seeing it. I need to test a compiler flag to know whether to enable it for our entire build. So I had planned on using test_compile(), but I don't see a way to pass additional compiler flags to test_compile() through CMAKE_FLAGS and there's no option to pass environment variables like CXXFLAGS with test_compile().</div><div><br></div><div>Also, when do the variables like CMAKE_CXX_FLAGS get set? I enable the CXX language and specify a required support for C++11, but if I dump CMAKE_CXX_FLAGS right after that there are no options such as -std=c++11 in the variable. I thought I could do something like ..</div><div><br></div><div>try_compile(.. CMAKE_FLAGS -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} <extra args>" ..)</div><div><br></div><div>... but CMAKE_CXX_FLAGS is empty as described above so I get errors about the compiler not supported C++11 features since -std=c++11 wasn't set.</div><div><br></div><div>Is there an example of testing a compiler flag I could try?</div><div><br></div><div>Thanks!</div></div>