diff options
Diffstat (limited to 'Tests/RunCMake/CompileFeatures')
26 files changed, 102 insertions, 0 deletions
diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11-result.txt b/Tests/RunCMake/CompileFeatures/RequireCXX11-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11-stderr.txt b/Tests/RunCMake/CompileFeatures/RequireCXX11-stderr.txt new file mode 100644 index 0000000000..0fc9112f8b --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target "foo" requires the language dialect "CXX11" , but CMake does not + know the compile flags to use to enable it. diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX11.cmake new file mode 100644 index 0000000000..10b251aa43 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11.cmake @@ -0,0 +1,4 @@ + +add_library(foo empty.cpp) +set_property(TARGET foo PROPERTY CXX_STANDARD 11) +set_property(TARGET foo PROPERTY CXX_STANDARD_REQUIRED TRUE) diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11Ext-result.txt b/Tests/RunCMake/CompileFeatures/RequireCXX11Ext-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11Ext-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11Ext-stderr.txt b/Tests/RunCMake/CompileFeatures/RequireCXX11Ext-stderr.txt new file mode 100644 index 0000000000..5c68a1cf78 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11Ext-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target "foo" requires the language dialect "CXX11" \(with compiler + extensions\), but CMake does not know the compile flags to use to enable it. diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11Ext.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX11Ext.cmake new file mode 100644 index 0000000000..9e726c8350 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11Ext.cmake @@ -0,0 +1,5 @@ + +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-result.txt b/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable-stderr.txt b/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable-stderr.txt new file mode 100644 index 0000000000..5c68a1cf78 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target "foo" requires the language dialect "CXX11" \(with compiler + extensions\), but CMake does not know the compile flags to use to enable it. diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable.cmake new file mode 100644 index 0000000000..8f6755fc6a --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11ExtVariable.cmake @@ -0,0 +1,5 @@ + +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-result.txt b/Tests/RunCMake/CompileFeatures/RequireCXX11Variable-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11Variable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11Variable-stderr.txt b/Tests/RunCMake/CompileFeatures/RequireCXX11Variable-stderr.txt new file mode 100644 index 0000000000..0fc9112f8b --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11Variable-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target "foo" requires the language dialect "CXX11" , but CMake does not + know the compile flags to use to enable it. diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX11Variable.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX11Variable.cmake new file mode 100644 index 0000000000..29703db68a --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX11Variable.cmake @@ -0,0 +1,4 @@ + +set(CMAKE_CXX_STANDARD_REQUIRED TRUE) +add_library(foo empty.cpp) +set_property(TARGET foo PROPERTY CXX_STANDARD 11) diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98-result.txt b/Tests/RunCMake/CompileFeatures/RequireCXX98-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98-stderr.txt b/Tests/RunCMake/CompileFeatures/RequireCXX98-stderr.txt new file mode 100644 index 0000000000..47c86889fe --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target "foo" requires the language dialect "CXX98" , but CMake does not + know the compile flags to use to enable it. diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX98.cmake new file mode 100644 index 0000000000..4ea595edb3 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98.cmake @@ -0,0 +1,4 @@ + +add_library(foo empty.cpp) +set_property(TARGET foo PROPERTY CXX_STANDARD 98) +set_property(TARGET foo PROPERTY CXX_STANDARD_REQUIRED TRUE) diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98Ext-result.txt b/Tests/RunCMake/CompileFeatures/RequireCXX98Ext-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98Ext-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98Ext-stderr.txt b/Tests/RunCMake/CompileFeatures/RequireCXX98Ext-stderr.txt new file mode 100644 index 0000000000..b4fdf8a455 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98Ext-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target "foo" requires the language dialect "CXX98" \(with compiler + extensions\), but CMake does not know the compile flags to use to enable it. diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98Ext.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX98Ext.cmake new file mode 100644 index 0000000000..fdf4cc7778 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98Ext.cmake @@ -0,0 +1,5 @@ + +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-result.txt b/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable-stderr.txt b/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable-stderr.txt new file mode 100644 index 0000000000..b4fdf8a455 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target "foo" requires the language dialect "CXX98" \(with compiler + extensions\), but CMake does not know the compile flags to use to enable it. diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable.cmake new file mode 100644 index 0000000000..a26a22d42b --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98ExtVariable.cmake @@ -0,0 +1,5 @@ + +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-result.txt b/Tests/RunCMake/CompileFeatures/RequireCXX98Variable-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98Variable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98Variable-stderr.txt b/Tests/RunCMake/CompileFeatures/RequireCXX98Variable-stderr.txt new file mode 100644 index 0000000000..47c86889fe --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98Variable-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target "foo" requires the language dialect "CXX98" , but CMake does not + know the compile flags to use to enable it. diff --git a/Tests/RunCMake/CompileFeatures/RequireCXX98Variable.cmake b/Tests/RunCMake/CompileFeatures/RequireCXX98Variable.cmake new file mode 100644 index 0000000000..0e3ef8dfb9 --- /dev/null +++ b/Tests/RunCMake/CompileFeatures/RequireCXX98Variable.cmake @@ -0,0 +1,4 @@ + +set(CMAKE_CXX_STANDARD_REQUIRED TRUE) +add_library(foo empty.cpp) +set_property(TARGET foo PROPERTY CXX_STANDARD 98) diff --git a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake index 43d4cb3ea6..f083751c22 100644 --- a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake @@ -18,3 +18,18 @@ if (NOT FEATURES) run_cmake(NoSupportedCxxFeatures) run_cmake(NoSupportedCxxFeaturesGenex) endif() + +foreach(standard 98 11) + file(READ + "${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx${standard}_flag.txt" + CXX${standard}_FLAG + ) + if (CXX${standard}_FLAG STREQUAL NOTFOUND) + run_cmake(RequireCXX${standard}) + run_cmake(RequireCXX${standard}Variable) + endif() + if (CXX${standard}EXT_FLAG STREQUAL NOTFOUND) + run_cmake(RequireCXX${standard}Ext) + run_cmake(RequireCXX${standard}ExtVariable) + endif() +endforeach() diff --git a/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake b/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake index 2bbbd17ff0..06c4f739b5 100644 --- a/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake +++ b/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake @@ -2,3 +2,22 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/features.txt" "${CMAKE_CXX_COMPILE_FEATURES}" ) + +foreach(standard 98 11) + set(CXX${standard}_FLAG NOTFOUND) + if (DEFINED CMAKE_CXX${standard}_STANDARD_COMPILE_OPTION) + set(CXX${standard}_FLAG ${CMAKE_CXX${standard}_STANDARD_COMPILE_OPTION}) + endif() + + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cxx${standard}_flag.txt" + "${CXX${standard}_FLAG}" + ) + set(CXX${standard}EXT_FLAG NOTFOUND) + if (DEFINED CMAKE_CXX${standard}_EXTENSION_COMPILE_OPTION) + set(CXX${standard}EXT_FLAG ${CMAKE_CXX${standard}_EXTENSION_COMPILE_OPTION}) + endif() + + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cxx${standard}ext_flag.txt" + "${CXX${standard}EXT_FLAG}" + ) +endforeach() |