diff options
author | Brad King <brad.king@kitware.com> | 2014-05-08 15:27:53 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-05-08 15:27:53 (GMT) |
commit | 7b3def93b630ee7964b1d33b2b601e07c7797438 (patch) | |
tree | 574eca7299af0b5a5898d6aff6b83dc5aef66311 /Tests/RunCMake | |
parent | 6eafe843ca632eadd896cca95c42420b48e2a9a2 (diff) | |
parent | 205215fb8a8aa950026d914377a54ae358a1c02a (diff) | |
download | CMake-7b3def93b630ee7964b1d33b2b601e07c7797438.zip CMake-7b3def93b630ee7964b1d33b2b601e07c7797438.tar.gz CMake-7b3def93b630ee7964b1d33b2b601e07c7797438.tar.bz2 |
Merge topic 'decay-language-version'
205215fb cmTarget: Add CXX_STANDARD_REQUIRED to control decay.
1df2116b Features: Decay language flag if requested is not available.
c4f4dac2 Project: Fix exit-on-error with compile feature tests.
5bb7ce72 Project: Use nullary form of main for compile feature tests.
64254e7a Project: Remove extern from static string in feature tests.
0d9c99bf Help: Fix order of help entries.
dc7639bd Tests: Fix name of cache variable.
Diffstat (limited to 'Tests/RunCMake')
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 0000000..d00491f --- /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 0000000..0fc9112 --- /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 0000000..10b251a --- /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 0000000..d00491f --- /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 0000000..5c68a1c --- /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 0000000..9e726c8 --- /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 0000000..d00491f --- /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 0000000..5c68a1c --- /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 0000000..8f6755f --- /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 0000000..d00491f --- /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 0000000..0fc9112 --- /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 0000000..29703db --- /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 0000000..d00491f --- /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 0000000..47c8688 --- /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 0000000..4ea595e --- /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 0000000..d00491f --- /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 0000000..b4fdf8a --- /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 0000000..fdf4cc7 --- /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 0000000..d00491f --- /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 0000000..b4fdf8a --- /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 0000000..a26a22d --- /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 0000000..d00491f --- /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 0000000..47c8688 --- /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 0000000..0e3ef8d --- /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 43d4cb3..f083751 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 2bbbd17..06c4f73 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() |