[CMake] CMAKE_CXX_STANDARD does not get used in PERFORM_CMAKE_TEST

Brad King brad.king at kitware.com
Fri Dec 4 14:22:15 EST 2015


On 12/04/2015 02:14 PM, Johnson, Hans J wrote:
> PERFORM_CMAKE_TEST(vxl_platform_tests.cxx VCL_STATIC_CONST_INIT_FLOAT)
> NOTE: THIS FAILS WHEN IT SHOULD PASS!
[snip]
> Should I simply add -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD}
> to the TRY_COMPILE?  The seems too simplistic.

I think that is all that is needed but have not thought this through
in detail.  Here is a related issue:

 https://cmake.org/Bug/view.php?id=15361#c37760

Eventually a similar fix will be needed for all CMake's builtin
check modules.  Perhaps even try_compile itself will need new
options to specify the language dialect, defaulting to the
CMAKE_<LANG>_STANDARD variable if set.

-Brad



More information about the CMake mailing list