mirror of
https://github.com/reactos/CMake.git
synced 2024-12-14 23:29:57 +00:00
bb5905bb13
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.
21 lines
433 B
CMake
21 lines
433 B
CMake
|
|
cmake_minimum_required(VERSION 3.0)
|
|
|
|
project(OriginDebug)
|
|
|
|
set(CMAKE_DEBUG_TARGET_PROPERTIES SOURCES)
|
|
|
|
add_library(iface INTERFACE)
|
|
set_property(TARGET iface PROPERTY INTERFACE_SOURCES
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/empty_1.cpp"
|
|
)
|
|
|
|
add_library(OriginDebug empty_2.cpp)
|
|
target_link_libraries(OriginDebug iface)
|
|
|
|
set_property(TARGET OriginDebug APPEND PROPERTY SOURCES
|
|
empty_3.cpp
|
|
)
|
|
|
|
target_sources(OriginDebug PRIVATE empty_4.cpp)
|