diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-05-30 13:03:45 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-05-31 10:16:12 (GMT) |
commit | 60a981ea8eda7a5af679ca3b2e4d54bc50ad61b3 (patch) | |
tree | f2344920e6c0358ca970ec70302a79e2dbc58f43 /Tests/CxxDialect | |
parent | 8afbb346c67c60dcf9383f5e58307d629eafb855 (diff) | |
download | CMake-60a981ea8eda7a5af679ca3b2e4d54bc50ad61b3.zip CMake-60a981ea8eda7a5af679ca3b2e4d54bc50ad61b3.tar.gz CMake-60a981ea8eda7a5af679ca3b2e4d54bc50ad61b3.tar.bz2 |
Features: Enable compiler extensions by default.
Compilers enable their extensions by default, and disabling them
implicitly can lead to results which are surprising or non-obvious
to debug.
http://public.kitware.com/pipermail/cmake-developers/2014-May/010575.html
http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/10214
https://www.mail-archive.com/cmake-developers@cmake.org/msg10116.html
(Compiler feature extensions by default, 29 May 2014)
Diffstat (limited to 'Tests/CxxDialect')
-rw-r--r-- | Tests/CxxDialect/CMakeLists.txt | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Tests/CxxDialect/CMakeLists.txt b/Tests/CxxDialect/CMakeLists.txt index 0eb6f8f..8c90339 100644 --- a/Tests/CxxDialect/CMakeLists.txt +++ b/Tests/CxxDialect/CMakeLists.txt @@ -4,11 +4,25 @@ project(CxxDialect) add_executable(use_typeof use_typeof.cxx) set_property(TARGET use_typeof PROPERTY CXX_STANDARD 98) -set_property(TARGET use_typeof PROPERTY CXX_EXTENSIONS ON) add_executable(use_constexpr use_constexpr.cxx) set_property(TARGET use_constexpr PROPERTY CXX_STANDARD 11) add_executable(CxxDialect use_constexpr_and_typeof.cxx) set_property(TARGET CxxDialect PROPERTY CXX_STANDARD 11) -set_property(TARGET CxxDialect PROPERTY CXX_EXTENSIONS ON) + +try_compile(typeof_no_extensions_works + "${CMAKE_CURRENT_BINARY_DIR}/use_typeof_test" + "${CMAKE_CURRENT_SOURCE_DIR}/use_typeof.cxx" + COMPILE_DEFINITIONS + CMAKE_FLAGS + "-DCMAKE_CXX_STANDARD=98" + "-DCMAKE_CXX_EXTENSIONS=FALSE" + OUTPUT_VARIABLE OUTPUT +) + +if (typeof_no_extensions_works) + message("Use of typeof extension with extensions disabled works, but is expected to fail: ${OUTPUT}") +else() + message("Use of typeof extension with extensions disabled fails, as expected") +endif() |