diff options
Diffstat (limited to 'Tests/RunCMake/target_sources')
59 files changed, 364 insertions, 3 deletions
diff --git a/Tests/RunCMake/target_sources/AddCustomTargetCheckProperty.cmake b/Tests/RunCMake/target_sources/AddCustomTargetCheckProperty.cmake new file mode 100644 index 0000000..1787e87 --- /dev/null +++ b/Tests/RunCMake/target_sources/AddCustomTargetCheckProperty.cmake @@ -0,0 +1,16 @@ +add_custom_target(target1 ALL) +target_sources(target1 PRIVATE main.cpp) +get_property(actualProp1 TARGET target1 PROPERTY SOURCES) +set(desiredProp1 main.cpp) +if(NOT desiredProp1 STREQUAL actualProp1) + message("source property not set. desired: \"${desiredProp1}\" actual: \"${actualProp1}\"") +endif() + +add_custom_target(target2 ALL SOURCES main.cpp) +target_sources(target2 PRIVATE empty_1.cpp empty_2.cpp) +target_sources(target2 PRIVATE empty_3.cpp) +get_property(actualProp2 TARGET target2 PROPERTY SOURCES) +set(desiredProp2 main.cpp empty_1.cpp empty_2.cpp empty_3.cpp) +if (NOT desiredProp2 STREQUAL actualProp2) + message("source property not set. desired: \"${desiredProp2}\" actual: \"${actualProp2}\"") +endif() diff --git a/Tests/RunCMake/target_sources/AddCustomTargetGenx.cmake b/Tests/RunCMake/target_sources/AddCustomTargetGenx.cmake new file mode 100644 index 0000000..0078eab --- /dev/null +++ b/Tests/RunCMake/target_sources/AddCustomTargetGenx.cmake @@ -0,0 +1,2 @@ +add_custom_target(target ALL) +target_sources(target PRIVATE $<IF:1,${CMAKE_CURRENT_LIST_DIR}/main.cpp,${CMAKE_CURRENT_LIST_DIR}/empty_1.cpp>) diff --git a/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources-result.txt b/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources-stderr.txt b/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources-stderr.txt new file mode 100644 index 0000000..9334bf6 --- /dev/null +++ b/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at AddCustomTargetInterfaceSources.cmake:2 \(target_sources\): + target_sources may only set PRIVATE properties on custom targets +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources.cmake b/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources.cmake new file mode 100644 index 0000000..42a8ca2 --- /dev/null +++ b/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources.cmake @@ -0,0 +1,2 @@ +add_custom_target(target ALL) +target_sources(target INTERFACE main.cpp) diff --git a/Tests/RunCMake/target_sources/AddCustomTargetPrivateSources.cmake b/Tests/RunCMake/target_sources/AddCustomTargetPrivateSources.cmake new file mode 100644 index 0000000..11f0258 --- /dev/null +++ b/Tests/RunCMake/target_sources/AddCustomTargetPrivateSources.cmake @@ -0,0 +1,2 @@ +add_custom_target(target ALL) +target_sources(target PRIVATE main.cpp) diff --git a/Tests/RunCMake/target_sources/AddCustomTargetPublicSources-result.txt b/Tests/RunCMake/target_sources/AddCustomTargetPublicSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/AddCustomTargetPublicSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/AddCustomTargetPublicSources-stderr.txt b/Tests/RunCMake/target_sources/AddCustomTargetPublicSources-stderr.txt new file mode 100644 index 0000000..afba4be --- /dev/null +++ b/Tests/RunCMake/target_sources/AddCustomTargetPublicSources-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at AddCustomTargetPublicSources.cmake:2 \(target_sources\): + target_sources may only set PRIVATE properties on custom targets +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_sources/AddCustomTargetPublicSources.cmake b/Tests/RunCMake/target_sources/AddCustomTargetPublicSources.cmake new file mode 100644 index 0000000..d9e82c0 --- /dev/null +++ b/Tests/RunCMake/target_sources/AddCustomTargetPublicSources.cmake @@ -0,0 +1,2 @@ +add_custom_target(target ALL) +target_sources(target PUBLIC main.cpp) diff --git a/Tests/RunCMake/target_sources/AddCustomTargetSources-result.txt b/Tests/RunCMake/target_sources/AddCustomTargetSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/AddCustomTargetSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/AddCustomTargetSources-stderr.txt b/Tests/RunCMake/target_sources/AddCustomTargetSources-stderr.txt new file mode 100644 index 0000000..4a153e9 --- /dev/null +++ b/Tests/RunCMake/target_sources/AddCustomTargetSources-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at AddCustomTargetSources.cmake:2 \(target_sources\): + target_sources called with invalid arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_sources/AddCustomTargetSources.cmake b/Tests/RunCMake/target_sources/AddCustomTargetSources.cmake new file mode 100644 index 0000000..dd688d3 --- /dev/null +++ b/Tests/RunCMake/target_sources/AddCustomTargetSources.cmake @@ -0,0 +1,2 @@ +add_custom_target(target ALL) +target_sources(target main.cpp) diff --git a/Tests/RunCMake/target_sources/CMP0026-LOCATION-result.txt b/Tests/RunCMake/target_sources/CMP0026-LOCATION-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/target_sources/CMP0026-LOCATION-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/target_sources/CMP0026-LOCATION-stderr.txt b/Tests/RunCMake/target_sources/CMP0026-LOCATION-stderr.txt new file mode 100644 index 0000000..d7ccedb --- /dev/null +++ b/Tests/RunCMake/target_sources/CMP0026-LOCATION-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0026-LOCATION.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0026 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/CMP0026-LOCATION.cmake b/Tests/RunCMake/target_sources/CMP0026-LOCATION.cmake new file mode 100644 index 0000000..642856c --- /dev/null +++ b/Tests/RunCMake/target_sources/CMP0026-LOCATION.cmake @@ -0,0 +1,14 @@ + +cmake_policy(SET CMP0026 OLD) +enable_language(CXX) + +add_library(objlib OBJECT + empty_1.cpp +) + +add_executable(my_exe + empty_2.cpp + $<TARGET_OBJECTS:objlib> +) + +get_target_property( loc my_exe LOCATION) diff --git a/Tests/RunCMake/target_sources/CMP0076-OLD-result.txt b/Tests/RunCMake/target_sources/CMP0076-OLD-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/CMP0076-OLD-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/CMP0076-OLD-stderr.txt b/Tests/RunCMake/target_sources/CMP0076-OLD-stderr.txt new file mode 100644 index 0000000..d47dd4d --- /dev/null +++ b/Tests/RunCMake/target_sources/CMP0076-OLD-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/target_sources/CMP0076-OLD.cmake b/Tests/RunCMake/target_sources/CMP0076-OLD.cmake new file mode 100644 index 0000000..4d8c268 --- /dev/null +++ b/Tests/RunCMake/target_sources/CMP0076-OLD.cmake @@ -0,0 +1,10 @@ +cmake_policy(SET CMP0076 OLD) + +add_library(iface INTERFACE) +target_sources(iface INTERFACE empty_1.cpp) + +get_property(iface_sources TARGET iface PROPERTY INTERFACE_SOURCES) +message(STATUS "iface: ${iface_sources}") + +add_executable(main main.cpp) +target_link_libraries(main iface) diff --git a/Tests/RunCMake/target_sources/CMP0076-WARN-result.txt b/Tests/RunCMake/target_sources/CMP0076-WARN-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/CMP0076-WARN-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/CMP0076-WARN-stderr.txt b/Tests/RunCMake/target_sources/CMP0076-WARN-stderr.txt new file mode 100644 index 0000000..bd888ee --- /dev/null +++ b/Tests/RunCMake/target_sources/CMP0076-WARN-stderr.txt @@ -0,0 +1,21 @@ +CMake Warning \(dev\) at CMP0076-WARN/CMakeLists\.txt:[0-9]+ \(target_sources\): + Policy CMP0076 is not set: target_sources\(\) command converts relative paths + to absolute. Run "cmake --help-policy CMP0076" for policy details. Use + the cmake_policy command to set the policy and suppress this warning. + + An interface source of target "publiclib" has a relative path. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at CMP0076-WARN/CMakeLists\.txt:[0-9]+ \(target_sources\): + Policy CMP0076 is not set: target_sources\(\) command converts relative paths + to absolute. Run "cmake --help-policy CMP0076" for policy details. Use + the cmake_policy command to set the policy and suppress this warning. + + A private source from a directory other than that of target "publiclib" has + a relative path. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Error in CMakeLists.txt: + Target "publiclib" contains relative path in its INTERFACE_SOURCES: + + "CMP0076-WARN/subdir_empty_1.cpp" diff --git a/Tests/RunCMake/target_sources/CMP0076-WARN.cmake b/Tests/RunCMake/target_sources/CMP0076-WARN.cmake new file mode 100644 index 0000000..2e07331 --- /dev/null +++ b/Tests/RunCMake/target_sources/CMP0076-WARN.cmake @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) + +add_library(publiclib) + +add_subdirectory(CMP0076-WARN) + +add_executable(main main.cpp) +target_link_libraries(main publiclib) diff --git a/Tests/RunCMake/target_sources/CMP0076-WARN/CMakeLists.txt b/Tests/RunCMake/target_sources/CMP0076-WARN/CMakeLists.txt new file mode 100644 index 0000000..f9c7d6d --- /dev/null +++ b/Tests/RunCMake/target_sources/CMP0076-WARN/CMakeLists.txt @@ -0,0 +1,3 @@ + +target_sources(publiclib INTERFACE CMP0076-WARN/subdir_empty_1.cpp + PRIVATE empty_1.cpp) diff --git a/Tests/RunCMake/target_sources/CMP0076-WARN/subdir_empty_1.cpp b/Tests/RunCMake/target_sources/CMP0076-WARN/subdir_empty_1.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/target_sources/CMP0076-WARN/subdir_empty_1.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/target_sources/CMakeLists.txt b/Tests/RunCMake/target_sources/CMakeLists.txt index 14ef56e..727f93a 100644 --- a/Tests/RunCMake/target_sources/CMakeLists.txt +++ b/Tests/RunCMake/target_sources/CMakeLists.txt @@ -1,5 +1,3 @@ cmake_minimum_required(VERSION 3.11) - project(${RunCMake_TEST} LANGUAGES NONE) - include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/target_sources/ConfigNotAllowed-result.txt b/Tests/RunCMake/target_sources/ConfigNotAllowed-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/ConfigNotAllowed-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/ConfigNotAllowed-stderr.txt b/Tests/RunCMake/target_sources/ConfigNotAllowed-stderr.txt new file mode 100644 index 0000000..bc4afb7 --- /dev/null +++ b/Tests/RunCMake/target_sources/ConfigNotAllowed-stderr.txt @@ -0,0 +1,12 @@ +CMake Error in CMakeLists.txt: + Target "somelib" has source files which vary by configuration. This is not + supported by the "[^"]+" generator. + + Config "Debug": + + .*/Tests/RunCMake/target_sources/empty_1.cpp + .*/Tests/RunCMake/target_sources/empty_2.cpp + + Config "Release": + + .*/Tests/RunCMake/target_sources/empty_1.cpp diff --git a/Tests/RunCMake/target_sources/ConfigNotAllowed.cmake b/Tests/RunCMake/target_sources/ConfigNotAllowed.cmake new file mode 100644 index 0000000..02af379 --- /dev/null +++ b/Tests/RunCMake/target_sources/ConfigNotAllowed.cmake @@ -0,0 +1,2 @@ + +add_library(somelib empty_1.cpp $<$<CONFIG:Debug>:empty_2.cpp>) diff --git a/Tests/RunCMake/target_sources/empty_keyword_args.cmake b/Tests/RunCMake/target_sources/EmptyKeywordArgs.cmake index 5cee451..5cee451 100644 --- a/Tests/RunCMake/target_sources/empty_keyword_args.cmake +++ b/Tests/RunCMake/target_sources/EmptyKeywordArgs.cmake diff --git a/Tests/RunCMake/target_sources/ExportBuild-result.txt b/Tests/RunCMake/target_sources/ExportBuild-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/target_sources/ExportBuild-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/target_sources/ExportBuild.cmake b/Tests/RunCMake/target_sources/ExportBuild.cmake new file mode 100644 index 0000000..b626aa6 --- /dev/null +++ b/Tests/RunCMake/target_sources/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/target_sources/OriginDebug-result.txt b/Tests/RunCMake/target_sources/OriginDebug-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/target_sources/OriginDebug-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/target_sources/OriginDebug-stderr.txt b/Tests/RunCMake/target_sources/OriginDebug-stderr.txt new file mode 100644 index 0000000..502d5f1 --- /dev/null +++ b/Tests/RunCMake/target_sources/OriginDebug-stderr.txt @@ -0,0 +1,31 @@ +CMake Debug Log at OriginDebug.cmake:13 \(add_library\): + Used sources for target OriginDebug: + + \* .*Tests/RunCMake/target_sources/empty_2.cpp + +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) +.* +CMake Debug Log at OriginDebug.cmake:16 \(set_property\): + Used sources for target OriginDebug: + + \* .*Tests/RunCMake/target_sources/empty_3.cpp + +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) +.* +CMake Debug Log at OriginDebug.cmake:20 \(target_sources\): + Used sources for target OriginDebug: + + \* .*Tests/RunCMake/target_sources/empty_4.cpp + +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) +.* +CMake Debug Log at OriginDebug.cmake:14 \(target_link_libraries\): + Used sources for target OriginDebug: + + \* .*Tests/RunCMake/target_sources/empty_1.cpp + +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_sources/OriginDebug.cmake b/Tests/RunCMake/target_sources/OriginDebug.cmake new file mode 100644 index 0000000..d40a1d8 --- /dev/null +++ b/Tests/RunCMake/target_sources/OriginDebug.cmake @@ -0,0 +1,20 @@ + +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) diff --git a/Tests/RunCMake/target_sources/RelativePathInInterface-stdout.txt b/Tests/RunCMake/target_sources/RelativePathInInterface-stdout.txt new file mode 100644 index 0000000..19818b8 --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInInterface-stdout.txt @@ -0,0 +1 @@ +-- iface: .*Tests/RunCMake/target_sources/empty_1.cpp diff --git a/Tests/RunCMake/target_sources/RelativePathInInterface.cmake b/Tests/RunCMake/target_sources/RelativePathInInterface.cmake new file mode 100644 index 0000000..25b22dd --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInInterface.cmake @@ -0,0 +1,11 @@ +cmake_policy(SET CMP0076 NEW) +enable_language(CXX) + +add_library(iface INTERFACE) +target_sources(iface INTERFACE empty_1.cpp) + +get_property(iface_sources TARGET iface PROPERTY INTERFACE_SOURCES) +message(STATUS "iface: ${iface_sources}") + +add_executable(main main.cpp) +target_link_libraries(main iface) diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx-stdout.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx-stdout.txt new file mode 100644 index 0000000..a51a792 --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx-stdout.txt @@ -0,0 +1 @@ +-- genexlib: \$<1:.*Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/subdir_empty_1.cpp>;\$<1:.*Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/../empty_1.cpp>;\$<1:empty_2.cpp> diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx.cmake b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx.cmake new file mode 100644 index 0000000..9afcea5 --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx.cmake @@ -0,0 +1,11 @@ +cmake_policy(SET CMP0076 NEW) +enable_language(CXX) + +add_library(genexlib) +add_subdirectory(RelativePathInSubdirGenEx) + +get_property(genexlib_sources TARGET genexlib PROPERTY SOURCES) +message(STATUS "genexlib: ${genexlib_sources}") + +add_executable(genexmain main.cpp) +target_link_libraries(genexmain genexlib) diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/CMakeLists.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/CMakeLists.txt new file mode 100644 index 0000000..3bcf454 --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/CMakeLists.txt @@ -0,0 +1,4 @@ + +target_sources(genexlib PUBLIC $<1:${CMAKE_CURRENT_LIST_DIR}/subdir_empty_1.cpp> + $<1:${CMAKE_CURRENT_LIST_DIR}/../empty_1.cpp> + PRIVATE $<1:empty_2.cpp>) diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/subdir_empty_1.cpp b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/subdir_empty_1.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/subdir_empty_1.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirInclude-stdout.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude-stdout.txt new file mode 100644 index 0000000..c42c88b --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude-stdout.txt @@ -0,0 +1 @@ +-- privatelib: .*Tests/RunCMake/target_sources/RelativePathInSubdirInclude/subdir_empty_1.cpp;empty_1.cpp diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirInclude.cmake b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude.cmake new file mode 100644 index 0000000..f5954c4 --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude.cmake @@ -0,0 +1,9 @@ +cmake_policy(SET CMP0076 NEW) +enable_language(CXX) + +add_library(privatelib) + +include("RelativePathInSubdirInclude/CMakeLists.txt") + +get_property(privatelib_sources TARGET privatelib PROPERTY SOURCES) +message(STATUS "privatelib: ${privatelib_sources}") diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirInclude/CMakeLists.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude/CMakeLists.txt new file mode 100644 index 0000000..3dcb135 --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude/CMakeLists.txt @@ -0,0 +1,3 @@ + +target_sources(privatelib PRIVATE "${CMAKE_CURRENT_LIST_DIR}/subdir_empty_1.cpp" + empty_1.cpp) diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirInclude/subdir_empty_1.cpp b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude/subdir_empty_1.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude/subdir_empty_1.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirInterface-stdout.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface-stdout.txt new file mode 100644 index 0000000..ebbb29f --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface-stdout.txt @@ -0,0 +1 @@ +-- iface: .*Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_1.cpp;.*Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_2.cpp;.*Tests/RunCMake/target_sources/RelativePathInSubdirInterface/../empty_1.cpp;.*Tests/RunCMake/target_sources/RelativePathInSubdirInterface/../empty_2.cpp diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirInterface.cmake b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface.cmake new file mode 100644 index 0000000..6a4e200 --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface.cmake @@ -0,0 +1,12 @@ +cmake_policy(SET CMP0076 NEW) +enable_language(CXX) + +add_library(iface INTERFACE) + +add_subdirectory(RelativePathInSubdirInterface) + +get_property(iface_sources TARGET iface PROPERTY INTERFACE_SOURCES) +message(STATUS "iface: ${iface_sources}") + +add_executable(main main.cpp) +target_link_libraries(main iface) diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirInterface/CMakeLists.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface/CMakeLists.txt new file mode 100644 index 0000000..02e6966 --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface/CMakeLists.txt @@ -0,0 +1,5 @@ + +target_sources(iface INTERFACE subdir_empty_1.cpp + "${CMAKE_CURRENT_LIST_DIR}/subdir_empty_2.cpp" + ../empty_1.cpp + "${CMAKE_CURRENT_LIST_DIR}/../empty_2.cpp") diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_1.cpp b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_1.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_1.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_2.cpp b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_2.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_2.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate-stdout.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate-stdout.txt new file mode 100644 index 0000000..104f1de --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate-stdout.txt @@ -0,0 +1 @@ +-- privatelib: .*Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_1.cpp;.*Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_2.cpp;.*Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/../empty_1.cpp;.*Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/../empty_2.cpp diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate.cmake b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate.cmake new file mode 100644 index 0000000..dd16e3f --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate.cmake @@ -0,0 +1,9 @@ +cmake_policy(SET CMP0076 NEW) +enable_language(CXX) + +add_library(privatelib) + +add_subdirectory(RelativePathInSubdirPrivate) + +get_property(privatelib_sources TARGET privatelib PROPERTY SOURCES) +message(STATUS "privatelib: ${privatelib_sources}") diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/CMakeLists.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/CMakeLists.txt new file mode 100644 index 0000000..56ee853 --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/CMakeLists.txt @@ -0,0 +1,5 @@ + +target_sources(privatelib PRIVATE subdir_empty_1.cpp + "${CMAKE_CURRENT_LIST_DIR}/subdir_empty_2.cpp" + ../empty_1.cpp + "${CMAKE_CURRENT_LIST_DIR}/../empty_2.cpp") diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_1.cpp b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_1.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_1.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_2.cpp b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_2.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_2.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/target_sources/RunCMakeTest.cmake b/Tests/RunCMake/target_sources/RunCMakeTest.cmake index b67c598..9d64927 100644 --- a/Tests/RunCMake/target_sources/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_sources/RunCMakeTest.cmake @@ -1,3 +1,23 @@ include(RunCMake) -run_cmake(empty_keyword_args) +if(RunCMake_GENERATOR STREQUAL "Xcode") + run_cmake(ConfigNotAllowed) +endif() + +run_cmake(EmptyKeywordArgs) +run_cmake(OriginDebug) +run_cmake(CMP0026-LOCATION) +run_cmake(CMP0076-OLD) +run_cmake(CMP0076-WARN) +run_cmake(RelativePathInInterface) +run_cmake(RelativePathInSubdirGenEx) +run_cmake(RelativePathInSubdirInterface) +run_cmake(RelativePathInSubdirPrivate) +run_cmake(RelativePathInSubdirInclude) +run_cmake(ExportBuild) +run_cmake(AddCustomTargetPublicSources) +run_cmake(AddCustomTargetPrivateSources) +run_cmake(AddCustomTargetInterfaceSources) +run_cmake(AddCustomTargetSources) +run_cmake(AddCustomTargetCheckProperty) +run_cmake(AddCustomTargetGenx) diff --git a/Tests/RunCMake/target_sources/empty_1.cpp b/Tests/RunCMake/target_sources/empty_1.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/target_sources/empty_1.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/target_sources/empty_2.cpp b/Tests/RunCMake/target_sources/empty_2.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/target_sources/empty_2.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/target_sources/empty_3.cpp b/Tests/RunCMake/target_sources/empty_3.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/target_sources/empty_3.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/target_sources/empty_4.cpp b/Tests/RunCMake/target_sources/empty_4.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/target_sources/empty_4.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/target_sources/main.cpp b/Tests/RunCMake/target_sources/main.cpp new file mode 100644 index 0000000..766b775 --- /dev/null +++ b/Tests/RunCMake/target_sources/main.cpp @@ -0,0 +1,5 @@ + +int main() +{ + return 0; +} |