summaryrefslogtreecommitdiffstats
path: root/Tests/CxxDialect/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/CxxDialect/CMakeLists.txt')
-rw-r--r--Tests/CxxDialect/CMakeLists.txt18
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()