CHECK_CXX_SOURCE_COMPILES doesn't use c++11 flags specified
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
I have
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED on)
in my cmake file - yet later when I try:
check_cxx_source_compiles(
"extern \"C\" void cmkcheckweak() __attribute__((weak));
int main(int argc, char** argv) {
return cmkcheckweak == nullptr; // works with (void*)0;
}" HAVE_WEAK_SYMBOLS)
it fails incorrectly because it invokes the compiler without the -std=gnu++11 it adds for regular files
(the goal/point of CMAKE_CXX_STANDARD_REQUIRED
is to use that compiler for everything and not me having to write code to guess the way to request c++11 compiler)
this is related to #15359 but while here there is an easy work around (not use nullptr and use 0 instead) that won't work for other tests I'm trying to do with CHECK_CXX_SOURCE_COMPILES
suggestions/workarounds on how to make CHECK_CXX_SOURCE_COMPILES
use the same compiler invocation as my other targets would be most welcome in the meantime