summaryrefslogtreecommitdiffstats
path: root/Tests/SourcesProperty
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-11-27 00:04:33 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-11-29 11:24:59 (GMT)
commitbb5905bb1342229c06cecee735322a8a28916b76 (patch)
tree38549e8a26392cf29f49c87b81229e93dd7e19a2 /Tests/SourcesProperty
parentd2f2a2e226a8717d6fdb6df0ed4858d1629f557c (diff)
downloadCMake-bb5905bb1342229c06cecee735322a8a28916b76.zip
CMake-bb5905bb1342229c06cecee735322a8a28916b76.tar.gz
CMake-bb5905bb1342229c06cecee735322a8a28916b76.tar.bz2
cmTarget: Don't allow relative paths in INTERFACE_SOURCES
Follow the pattern of checks that are made for INTERFACE_INCLUDE_DIRECTORIES. Existence is already checked by cmSourceFile::GetFullPath. Add a check to disallow relative paths in source directories. Otherwise code such as target_sources(lib1 INTERFACE foo.cpp) would fail if consumed by a target in a different directory. Unlike the INTERFACE_INCLUDE_DIRECTORIES behavior, we don't care whether the entry comes from an IMPORTED target or not. In the include directories case, the directory for a non-imported target might not exist yet but might be created. In the sources case, a file which does not yet exist in the filesystem must be explicitly marked with the GENERATED property. Adjust existing tests and add a new test for the error.
Diffstat (limited to 'Tests/SourcesProperty')
-rw-r--r--Tests/SourcesProperty/CMakeLists.txt4
1 files changed, 3 insertions, 1 deletions
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)