summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-10-21 23:40:47 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-04-07 16:11:18 (GMT)
commit5412deded1073e9a217c771ae24e8c5a8a581a96 (patch)
tree2ab7c8215edfb7083425cb241a5310ed50ce3862 /Tests
parentbaff44345cff8e635766e020d316da514616c16e (diff)
downloadCMake-5412deded1073e9a217c771ae24e8c5a8a581a96.zip
CMake-5412deded1073e9a217c771ae24e8c5a8a581a96.tar.gz
CMake-5412deded1073e9a217c771ae24e8c5a8a581a96.tar.bz2
cmTarget: Transitively evaluate compiler features.
Extend the interface of the target_compile_features command with PUBLIC and INTERFACE keywords. Populate the INTERFACE_COMPILER_FEATURES target property if they are set. Consume the INTERFACE_COMPILER_FEATURES target property from linked dependent targets to determine the final required compiler features and the compile flag, if needed. Use the same pattern of origin-debugging which is used for other build properties.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CompileFeatures/CMakeLists.txt7
-rw-r--r--Tests/RunCMake/CompileFeatures/NotAFeatureTransitive-result.txt1
-rw-r--r--Tests/RunCMake/CompileFeatures/NotAFeatureTransitive-stderr.txt2
-rw-r--r--Tests/RunCMake/CompileFeatures/NotAFeatureTransitive.cmake6
-rw-r--r--Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug-result.txt1
-rw-r--r--Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug-stderr.txt11
-rw-r--r--Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug.cmake4
-rw-r--r--Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugGenex-result.txt1
-rw-r--r--Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugGenex-stderr.txt11
-rw-r--r--Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugGenex.cmake4
-rw-r--r--Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugTransitive-result.txt1
-rw-r--r--Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugTransitive-stderr.txt11
-rw-r--r--Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugTransitive.cmake6
-rw-r--r--Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake4
14 files changed, 70 insertions, 0 deletions
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt
index 2114f94..bceb6bb 100644
--- a/Tests/CompileFeatures/CMakeLists.txt
+++ b/Tests/CompileFeatures/CMakeLists.txt
@@ -27,3 +27,10 @@ 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/RunCMake/CompileFeatures/NotAFeatureTransitive-result.txt b/Tests/RunCMake/CompileFeatures/NotAFeatureTransitive-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/NotAFeatureTransitive-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CompileFeatures/NotAFeatureTransitive-stderr.txt b/Tests/RunCMake/CompileFeatures/NotAFeatureTransitive-stderr.txt
new file mode 100644
index 0000000..ff60e50
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/NotAFeatureTransitive-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error in CMakeLists.txt:
+ Specified unknown feature "not_a_feature" for target "somelib".
diff --git a/Tests/RunCMake/CompileFeatures/NotAFeatureTransitive.cmake b/Tests/RunCMake/CompileFeatures/NotAFeatureTransitive.cmake
new file mode 100644
index 0000000..7311aec
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/NotAFeatureTransitive.cmake
@@ -0,0 +1,6 @@
+
+add_library(iface INTERFACE)
+set_property(TARGET iface PROPERTY INTERFACE_COMPILE_FEATURES "not_a_feature")
+
+add_library(somelib STATIC empty.cpp)
+target_link_libraries(somelib iface)
diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug-result.txt b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug-stderr.txt b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug-stderr.txt
new file mode 100644
index 0000000..60a8e51
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug-stderr.txt
@@ -0,0 +1,11 @@
+CMake Debug Log at NotAFeature_OriginDebug.cmake:4 \(set_property\):
+ Used compile features for target somelib:
+
+ \* not_a_feature
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+
+
+CMake Error in CMakeLists.txt:
+ Specified unknown feature "not_a_feature" for target "somelib".
diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug.cmake b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug.cmake
new file mode 100644
index 0000000..350c2ea
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug.cmake
@@ -0,0 +1,4 @@
+
+set(CMAKE_DEBUG_TARGET_PROPERTIES COMPILE_FEATURES)
+add_library(somelib STATIC empty.cpp)
+set_property(TARGET somelib PROPERTY COMPILE_FEATURES "not_a_feature")
diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugGenex-result.txt b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugGenex-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugGenex-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugGenex-stderr.txt b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugGenex-stderr.txt
new file mode 100644
index 0000000..08e20a8
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugGenex-stderr.txt
@@ -0,0 +1,11 @@
+CMake Debug Log at NotAFeature_OriginDebugGenex.cmake:4 \(set_property\):
+ Used compile features for target somelib:
+
+ \* not_a_feature
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+
+
+CMake Error in CMakeLists.txt:
+ Specified unknown feature "not_a_feature" for target "somelib".
diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugGenex.cmake b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugGenex.cmake
new file mode 100644
index 0000000..2122981
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugGenex.cmake
@@ -0,0 +1,4 @@
+
+set(CMAKE_DEBUG_TARGET_PROPERTIES COMPILE_FEATURES)
+add_library(somelib STATIC empty.cpp)
+set_property(TARGET somelib PROPERTY COMPILE_FEATURES "$<1:not_a_feature>")
diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugTransitive-result.txt b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugTransitive-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugTransitive-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugTransitive-stderr.txt b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugTransitive-stderr.txt
new file mode 100644
index 0000000..23c3305
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugTransitive-stderr.txt
@@ -0,0 +1,11 @@
+CMake Debug Log at NotAFeature_OriginDebugTransitive.cmake:6 \(target_link_libraries\):
+ Used compile features for target somelib:
+
+ \* not_a_feature
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+
+
+CMake Error in CMakeLists.txt:
+ Specified unknown feature "not_a_feature" for target "somelib".
diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugTransitive.cmake b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugTransitive.cmake
new file mode 100644
index 0000000..05d0073
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugTransitive.cmake
@@ -0,0 +1,6 @@
+
+set(CMAKE_DEBUG_TARGET_PROPERTIES COMPILE_FEATURES)
+add_library(iface INTERFACE)
+set_property(TARGET iface PROPERTY INTERFACE_COMPILE_FEATURES "not_a_feature")
+add_library(somelib STATIC empty.cpp)
+target_link_libraries(somelib iface)
diff --git a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
index da9477d..a059900 100644
--- a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
@@ -2,3 +2,7 @@ include(RunCMake)
run_cmake(NotAFeature)
run_cmake(NotAFeatureGenex)
+run_cmake(NotAFeatureTransitive)
+run_cmake(NotAFeature_OriginDebug)
+run_cmake(NotAFeature_OriginDebugGenex)
+run_cmake(NotAFeature_OriginDebugTransitive)