diff options
Diffstat (limited to 'Tests')
9 files changed, 20 insertions, 6 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() diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX11.cmake index 10b251a..f60504f 100644 --- a/Tests/RunCMake/CompileFeatures/RequireCXX11.cmake +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11.cmake @@ -1,4 +1,5 @@ add_library(foo empty.cpp) set_property(TARGET foo PROPERTY CXX_STANDARD 11) +set_property(TARGET foo PROPERTY CXX_EXTENSIONS FALSE) set_property(TARGET foo PROPERTY CXX_STANDARD_REQUIRED TRUE) diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11Ext.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX11Ext.cmake index 9e726c8..10b251a 100644 --- a/Tests/RunCMake/CompileFeatures/RequireCXX11Ext.cmake +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11Ext.cmake @@ -1,5 +1,4 @@ add_library(foo empty.cpp) set_property(TARGET foo PROPERTY CXX_STANDARD 11) -set_property(TARGET foo PROPERTY CXX_EXTENSIONS TRUE) set_property(TARGET foo PROPERTY CXX_STANDARD_REQUIRED TRUE) diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable.cmake index 8f6755f..29703db 100644 --- a/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable.cmake +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable.cmake @@ -2,4 +2,3 @@ set(CMAKE_CXX_STANDARD_REQUIRED TRUE) add_library(foo empty.cpp) set_property(TARGET foo PROPERTY CXX_STANDARD 11) -set_property(TARGET foo PROPERTY CXX_EXTENSIONS TRUE) diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11Variable.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX11Variable.cmake index 29703db..c480997 100644 --- a/Tests/RunCMake/CompileFeatures/RequireCXX11Variable.cmake +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11Variable.cmake @@ -2,3 +2,4 @@ set(CMAKE_CXX_STANDARD_REQUIRED TRUE) add_library(foo empty.cpp) set_property(TARGET foo PROPERTY CXX_STANDARD 11) +set_property(TARGET foo PROPERTY CXX_EXTENSIONS FALSE) diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX98.cmake index 4ea595e..fd9fb60 100644 --- a/Tests/RunCMake/CompileFeatures/RequireCXX98.cmake +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98.cmake @@ -2,3 +2,4 @@ add_library(foo empty.cpp) set_property(TARGET foo PROPERTY CXX_STANDARD 98) set_property(TARGET foo PROPERTY CXX_STANDARD_REQUIRED TRUE) +set_property(TARGET foo PROPERTY CXX_EXTENSIONS FALSE) diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98Ext.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX98Ext.cmake index fdf4cc7..4ea595e 100644 --- a/Tests/RunCMake/CompileFeatures/RequireCXX98Ext.cmake +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98Ext.cmake @@ -1,5 +1,4 @@ add_library(foo empty.cpp) set_property(TARGET foo PROPERTY CXX_STANDARD 98) -set_property(TARGET foo PROPERTY CXX_EXTENSIONS TRUE) set_property(TARGET foo PROPERTY CXX_STANDARD_REQUIRED TRUE) diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable.cmake index a26a22d..0e3ef8d 100644 --- a/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable.cmake +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable.cmake @@ -2,4 +2,3 @@ set(CMAKE_CXX_STANDARD_REQUIRED TRUE) add_library(foo empty.cpp) set_property(TARGET foo PROPERTY CXX_STANDARD 98) -set_property(TARGET foo PROPERTY CXX_EXTENSIONS TRUE) diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98Variable.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX98Variable.cmake index 0e3ef8d..7562264 100644 --- a/Tests/RunCMake/CompileFeatures/RequireCXX98Variable.cmake +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98Variable.cmake @@ -2,3 +2,4 @@ set(CMAKE_CXX_STANDARD_REQUIRED TRUE) add_library(foo empty.cpp) set_property(TARGET foo PROPERTY CXX_STANDARD 98) +set_property(TARGET foo PROPERTY CXX_EXTENSIONS FALSE) |