summaryrefslogtreecommitdiffstats
path: root/Tests/CxxDialect
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-10-13 00:00:24 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-04-07 14:48:44 (GMT)
commit913394af249d6b1892a6e609d2abfed001fa1dc4 (patch)
tree484096975102a7da96f95e184d48aff7f6393492 /Tests/CxxDialect
parent8238a6cd5d2867e709e87a752e0a24c7c2bf28f0 (diff)
downloadCMake-913394af249d6b1892a6e609d2abfed001fa1dc4.zip
CMake-913394af249d6b1892a6e609d2abfed001fa1dc4.tar.gz
CMake-913394af249d6b1892a6e609d2abfed001fa1dc4.tar.bz2
cmTarget: Add CXX_STANDARD and CXX_EXTENSION target properties.
These are used to determine whether to add -std=c++11, -std=gnu++11 etc flags on the compile line.
Diffstat (limited to 'Tests/CxxDialect')
-rw-r--r--Tests/CxxDialect/CMakeLists.txt14
-rw-r--r--Tests/CxxDialect/use_constexpr.cxx10
-rw-r--r--Tests/CxxDialect/use_constexpr_and_typeof.cxx11
-rw-r--r--Tests/CxxDialect/use_typeof.cxx6
4 files changed, 41 insertions, 0 deletions
diff --git a/Tests/CxxDialect/CMakeLists.txt b/Tests/CxxDialect/CMakeLists.txt
new file mode 100644
index 0000000..0eb6f8f
--- /dev/null
+++ b/Tests/CxxDialect/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 2.8.12)
+cmake_policy(SET CMP0025 NEW)
+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)
diff --git a/Tests/CxxDialect/use_constexpr.cxx b/Tests/CxxDialect/use_constexpr.cxx
new file mode 100644
index 0000000..30ccc4c
--- /dev/null
+++ b/Tests/CxxDialect/use_constexpr.cxx
@@ -0,0 +1,10 @@
+
+constexpr int foo()
+{
+ return 0;
+}
+
+int main(int argc, char**)
+{
+ return foo();
+}
diff --git a/Tests/CxxDialect/use_constexpr_and_typeof.cxx b/Tests/CxxDialect/use_constexpr_and_typeof.cxx
new file mode 100644
index 0000000..af217b6
--- /dev/null
+++ b/Tests/CxxDialect/use_constexpr_and_typeof.cxx
@@ -0,0 +1,11 @@
+
+constexpr int foo()
+{
+ return 0;
+}
+
+int main(int argc, char**)
+{
+ typeof(argc) ret = foo();
+ return ret;
+}
diff --git a/Tests/CxxDialect/use_typeof.cxx b/Tests/CxxDialect/use_typeof.cxx
new file mode 100644
index 0000000..dabb61f
--- /dev/null
+++ b/Tests/CxxDialect/use_typeof.cxx
@@ -0,0 +1,6 @@
+
+int main(int argc, char**)
+{
+ typeof(argc) ret = 0;
+ return ret;
+}