summaryrefslogtreecommitdiffstats
path: root/Tests/CompileFeatures
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-04-15 14:32:11 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-04-15 14:32:11 (GMT)
commitb56a9ae7f14189fd2bce2ca3e9441060ca231638 (patch)
tree0122235518aa6041be6866711fb2433b8c191070 /Tests/CompileFeatures
parent593b69c9dc9e692b198f1ddbf9251130e61a4679 (diff)
parent9eaf3755987821080908a289cefbf546773071f9 (diff)
downloadCMake-b56a9ae7f14189fd2bce2ca3e9441060ca231638.zip
CMake-b56a9ae7f14189fd2bce2ca3e9441060ca231638.tar.gz
CMake-b56a9ae7f14189fd2bce2ca3e9441060ca231638.tar.bz2
Merge topic 'target_compile_features'
9eaf3755 Export: Populate INTERFACE_COMPILE_FEATURES property. 8ed59fc2 Add target_compile_features command. 4e6ca504 cmTargetPropCommandBase: Change the interface to return bool. 5412dede cmTarget: Transitively evaluate compiler features. baff4434 cmTarget: Allow populating COMPILE_FEATURES using generator expressions. f97bf437 Features: Add cxx_auto_type. 03355d6b cmTarget: Add COMPILE_FEATURES target property. faeddf64 project: Add infrastructure for recording CXX compiler features 913394af cmTarget: Add CXX_STANDARD and CXX_EXTENSION target properties. 8238a6cd Add some COMPILE_OPTIONS for specifying C++ dialect. 892243fc Tests: Require CMake 3.0 for the SystemInformation test. 59b5fdd3 Don't load Clang-CXX from AppleClang-CXX.
Diffstat (limited to 'Tests/CompileFeatures')
-rw-r--r--Tests/CompileFeatures/CMakeLists.txt36
-rw-r--r--Tests/CompileFeatures/cxx_auto_type.cpp5
-rw-r--r--Tests/CompileFeatures/main.cpp6
3 files changed, 47 insertions, 0 deletions
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt
new file mode 100644
index 0000000..bceb6bb
--- /dev/null
+++ b/Tests/CompileFeatures/CMakeLists.txt
@@ -0,0 +1,36 @@
+
+cmake_minimum_required(VERSION 3.0)
+
+project(CompileFeatures)
+
+macro(run_test feature)
+ if (";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ${feature})
+ add_library(test_${feature} OBJECT ${feature}.cpp)
+ set_property(TARGET test_${feature}
+ PROPERTY COMPILE_FEATURES "${feature}"
+ )
+ else()
+ message("Not supported: ${feature}")
+ endif()
+endmacro()
+
+foreach(feature ${CMAKE_CXX_KNOWN_FEATURES})
+ run_test(${feature})
+endforeach()
+
+add_executable(CompileFeatures main.cpp)
+set_property(TARGET CompileFeatures
+ PROPERTY COMPILE_FEATURES "cxx_auto_type"
+)
+
+add_executable(GenexCompileFeatures main.cpp)
+set_property(TARGET GenexCompileFeatures
+ PROPERTY COMPILE_FEATURES "$<1:cxx_auto_type>;$<0:not_a_feature>"
+)
+
+add_library(iface INTERFACE)
+set_property(TARGET iface
+ PROPERTY INTERFACE_COMPILE_FEATURES "cxx_auto_type"
+)
+add_executable(IfaceCompileFeatures main.cpp)
+target_link_libraries(IfaceCompileFeatures iface)
diff --git a/Tests/CompileFeatures/cxx_auto_type.cpp b/Tests/CompileFeatures/cxx_auto_type.cpp
new file mode 100644
index 0000000..7dbf04f
--- /dev/null
+++ b/Tests/CompileFeatures/cxx_auto_type.cpp
@@ -0,0 +1,5 @@
+
+void someFunc()
+{
+ auto x = 3.14;
+}
diff --git a/Tests/CompileFeatures/main.cpp b/Tests/CompileFeatures/main.cpp
new file mode 100644
index 0000000..3a8e0fc
--- /dev/null
+++ b/Tests/CompileFeatures/main.cpp
@@ -0,0 +1,6 @@
+
+int main(int,char**)
+{
+ auto value = 0;
+ return value;
+}