summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-12-01 13:57:34 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-12-01 13:57:34 (GMT)
commit8e75f1d2fa3049ac31f4ebdbc255fca3e6414802 (patch)
tree4bb6af9da45afae0e91c2b19085157cbacc692fd /Tests
parent2a92231630b6aee671c7f4e8b64f69cfd172b9e3 (diff)
parent8a75c7ef32af391cb45af889d266e2a77daa61d6 (diff)
downloadCMake-8e75f1d2fa3049ac31f4ebdbc255fca3e6414802.zip
CMake-8e75f1d2fa3049ac31f4ebdbc255fca3e6414802.tar.gz
CMake-8e75f1d2fa3049ac31f4ebdbc255fca3e6414802.tar.bz2
Merge topic 'target-sources-error-conditions'
8a75c7ef Help: Document the export limitation of INTERFACE_SOURCES. e1348056 Export: Disallow export of targets with INTERFACE_SOURCES bb5905bb cmTarget: Don't allow relative paths in INTERFACE_SOURCES
Diffstat (limited to 'Tests')
-rw-r--r--Tests/ConfigSources/CMakeLists.txt6
-rw-r--r--Tests/RunCMake/TargetSources/ExportBuild-result.txt1
-rw-r--r--Tests/RunCMake/TargetSources/ExportBuild-stderr.txt1
-rw-r--r--Tests/RunCMake/TargetSources/ExportBuild.cmake5
-rw-r--r--Tests/RunCMake/TargetSources/ExportInstall-result.txt1
-rw-r--r--Tests/RunCMake/TargetSources/ExportInstall-stderr.txt1
-rw-r--r--Tests/RunCMake/TargetSources/ExportInstall.cmake6
-rw-r--r--Tests/RunCMake/TargetSources/OriginDebug.cmake2
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInInterface-result.txt1
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInInterface-stderr.txt4
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInInterface.cmake6
-rw-r--r--Tests/RunCMake/TargetSources/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/TargetSources/main.cpp5
-rw-r--r--Tests/SourcesProperty/CMakeLists.txt4
14 files changed, 41 insertions, 5 deletions
diff --git a/Tests/ConfigSources/CMakeLists.txt b/Tests/ConfigSources/CMakeLists.txt
index c272257..748aad8 100644
--- a/Tests/ConfigSources/CMakeLists.txt
+++ b/Tests/ConfigSources/CMakeLists.txt
@@ -5,9 +5,9 @@ project(ConfigSources)
add_library(iface INTERFACE)
set_property(TARGET iface PROPERTY INTERFACE_SOURCES
- iface_src.cpp
- $<$<CONFIG:Debug>:iface_debug_src.cpp>
- $<$<CONFIG:Release>:does_not_exist.cpp>
+ "${CMAKE_CURRENT_SOURCE_DIR}/iface_src.cpp"
+ "$<$<CONFIG:Debug>:${CMAKE_CURRENT_SOURCE_DIR}/iface_debug_src.cpp>"
+ "$<$<CONFIG:Release>:${CMAKE_CURRENT_SOURCE_DIR}/does_not_exist.cpp>"
)
add_executable(ConfigSources
diff --git a/Tests/RunCMake/TargetSources/ExportBuild-result.txt b/Tests/RunCMake/TargetSources/ExportBuild-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/ExportBuild-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetSources/ExportBuild-stderr.txt b/Tests/RunCMake/TargetSources/ExportBuild-stderr.txt
new file mode 100644
index 0000000..0d65a55
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/ExportBuild-stderr.txt
@@ -0,0 +1 @@
+CMake Error: Target "iface" has a populated INTERFACE_SOURCES property. This is not currently supported.
diff --git a/Tests/RunCMake/TargetSources/ExportBuild.cmake b/Tests/RunCMake/TargetSources/ExportBuild.cmake
new file mode 100644
index 0000000..b626aa6
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/ExportBuild.cmake
@@ -0,0 +1,5 @@
+
+add_library(iface INTERFACE)
+target_sources(iface INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/empty_1.cpp")
+
+export(TARGETS iface FILE ${CMAKE_CURRENT_BINARY_DIR}/targets.cmake)
diff --git a/Tests/RunCMake/TargetSources/ExportInstall-result.txt b/Tests/RunCMake/TargetSources/ExportInstall-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/ExportInstall-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetSources/ExportInstall-stderr.txt b/Tests/RunCMake/TargetSources/ExportInstall-stderr.txt
new file mode 100644
index 0000000..0d65a55
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/ExportInstall-stderr.txt
@@ -0,0 +1 @@
+CMake Error: Target "iface" has a populated INTERFACE_SOURCES property. This is not currently supported.
diff --git a/Tests/RunCMake/TargetSources/ExportInstall.cmake b/Tests/RunCMake/TargetSources/ExportInstall.cmake
new file mode 100644
index 0000000..8e7c9f9
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/ExportInstall.cmake
@@ -0,0 +1,6 @@
+
+add_library(iface INTERFACE)
+target_sources(iface INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/empty_1.cpp")
+
+install(TARGETS iface EXPORT exp)
+install(EXPORT exp DESTINATION cmake)
diff --git a/Tests/RunCMake/TargetSources/OriginDebug.cmake b/Tests/RunCMake/TargetSources/OriginDebug.cmake
index 5fe9ba7..d40a1d8 100644
--- a/Tests/RunCMake/TargetSources/OriginDebug.cmake
+++ b/Tests/RunCMake/TargetSources/OriginDebug.cmake
@@ -7,7 +7,7 @@ set(CMAKE_DEBUG_TARGET_PROPERTIES SOURCES)
add_library(iface INTERFACE)
set_property(TARGET iface PROPERTY INTERFACE_SOURCES
- empty_1.cpp
+ "${CMAKE_CURRENT_SOURCE_DIR}/empty_1.cpp"
)
add_library(OriginDebug empty_2.cpp)
diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface-result.txt b/Tests/RunCMake/TargetSources/RelativePathInInterface-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInInterface-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface-stderr.txt b/Tests/RunCMake/TargetSources/RelativePathInInterface-stderr.txt
new file mode 100644
index 0000000..d47dd4d
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInInterface-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error in CMakeLists.txt:
+ Target "iface" contains relative path in its INTERFACE_SOURCES:
+
+ "empty_1.cpp"
diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake b/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake
new file mode 100644
index 0000000..8bb6149
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake
@@ -0,0 +1,6 @@
+
+add_library(iface INTERFACE)
+target_sources(iface INTERFACE empty_1.cpp)
+
+add_executable(main main.cpp)
+target_link_libraries(main iface)
diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
index 1d2eaec..1b4ef0b 100644
--- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
+++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
@@ -8,3 +8,6 @@ else()
endif()
run_cmake(CMP0026-LOCATION)
+run_cmake(RelativePathInInterface)
+run_cmake(ExportBuild)
+run_cmake(ExportInstall)
diff --git a/Tests/RunCMake/TargetSources/main.cpp b/Tests/RunCMake/TargetSources/main.cpp
new file mode 100644
index 0000000..766b775
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/main.cpp
@@ -0,0 +1,5 @@
+
+int main()
+{
+ return 0;
+}
diff --git a/Tests/SourcesProperty/CMakeLists.txt b/Tests/SourcesProperty/CMakeLists.txt
index 6c99e00..d1c35d8 100644
--- a/Tests/SourcesProperty/CMakeLists.txt
+++ b/Tests/SourcesProperty/CMakeLists.txt
@@ -4,7 +4,9 @@ cmake_minimum_required(VERSION 3.0)
project(SourcesProperty)
add_library(iface INTERFACE)
-set_property(TARGET iface PROPERTY INTERFACE_SOURCES iface.cpp)
+set_property(TARGET iface PROPERTY INTERFACE_SOURCES
+ "${CMAKE_CURRENT_SOURCE_DIR}/iface.cpp"
+)
add_executable(SourcesProperty main.cpp)
target_link_libraries(SourcesProperty iface)