diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2021-07-16 19:51:26 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2021-10-27 19:17:23 (GMT) |
commit | a7c71b9f035175def9a3e53ed12112c6bb4862e5 (patch) | |
tree | 7aa37f1eec05036efaa0f051ef1419c6d1ab4c9a | |
parent | 4b0ee4e3385adbdd69765360e4dc34832ef2b256 (diff) | |
download | CMake-a7c71b9f035175def9a3e53ed12112c6bb4862e5.zip CMake-a7c71b9f035175def9a3e53ed12112c6bb4862e5.tar.gz CMake-a7c71b9f035175def9a3e53ed12112c6bb4862e5.tar.bz2 |
Tests: Add tests for target_sources(FILE_SET) and associated functionality
65 files changed, 436 insertions, 0 deletions
diff --git a/Tests/RunCMake/target_sources/FileSetChangeScope-result.txt b/Tests/RunCMake/target_sources/FileSetChangeScope-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetChangeScope-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetChangeScope-stderr.txt b/Tests/RunCMake/target_sources/FileSetChangeScope-stderr.txt new file mode 100644 index 0000000..600d006 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetChangeScope-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at FileSetChangeScope\.cmake:[0-9]+ \(target_sources\): + target_sources Scope PUBLIC for file set "a" does not match original scope + INTERFACE +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetChangeScope.cmake b/Tests/RunCMake/target_sources/FileSetChangeScope.cmake new file mode 100644 index 0000000..9d835fe --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetChangeScope.cmake @@ -0,0 +1,5 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 INTERFACE FILE_SET a TYPE HEADERS) +target_sources(lib1 PUBLIC FILE_SET a) diff --git a/Tests/RunCMake/target_sources/FileSetChangeType-result.txt b/Tests/RunCMake/target_sources/FileSetChangeType-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetChangeType-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetChangeType-stderr.txt b/Tests/RunCMake/target_sources/FileSetChangeType-stderr.txt new file mode 100644 index 0000000..85fc718 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetChangeType-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at FileSetChangeType\.cmake:[0-9]+ \(target_sources\): + target_sources Type "RESOURCES" for file set "a" does not match original + type "HEADERS" +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetChangeType.cmake b/Tests/RunCMake/target_sources/FileSetChangeType.cmake new file mode 100644 index 0000000..69eb6bc --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetChangeType.cmake @@ -0,0 +1,5 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS) +target_sources(lib1 PRIVATE FILE_SET a TYPE RESOURCES) diff --git a/Tests/RunCMake/target_sources/FileSetDefaultWrongType-result.txt b/Tests/RunCMake/target_sources/FileSetDefaultWrongType-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetDefaultWrongType-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetDefaultWrongType-stderr.txt b/Tests/RunCMake/target_sources/FileSetDefaultWrongType-stderr.txt new file mode 100644 index 0000000..faf0f5a --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetDefaultWrongType-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FileSetDefaultWrongType\.cmake:[0-9]+ \(target_sources\): + target_sources File set TYPE may only be "HEADERS" +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetDefaultWrongType.cmake b/Tests/RunCMake/target_sources/FileSetDefaultWrongType.cmake new file mode 100644 index 0000000..c810d66 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetDefaultWrongType.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 PRIVATE FILE_SET UNKNOWN) diff --git a/Tests/RunCMake/target_sources/FileSetDirectories.cmake b/Tests/RunCMake/target_sources/FileSetDirectories.cmake new file mode 100644 index 0000000..af30b1e --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetDirectories.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_subdirectory(dir3) +add_subdirectory(dir4) diff --git a/Tests/RunCMake/target_sources/FileSetExport.cmake b/Tests/RunCMake/target_sources/FileSetExport.cmake new file mode 100644 index 0000000..cde826a --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetExport.cmake @@ -0,0 +1,21 @@ +enable_language(C) + +add_library(lib1 STATIC lib1.c) +target_sources(lib1 + PUBLIC FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES error.c + PRIVATE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h + PUBLIC FILE_SET b TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h2.h + INTERFACE FILE_SET c TYPE HEADERS BASE_DIRS "$<1:${CMAKE_CURRENT_SOURCE_DIR}/dir>" FILES "$<1:dir/dir.h>" + INTERFACE FILE_SET d TYPE HEADERS BASE_DIRS FILES "${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>/empty.h" + INTERFACE FILE_SET e TYPE HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>" FILES "${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>/empty2.h" + INTERFACE FILE_SET f TYPE HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES "${CMAKE_CURRENT_SOURCE_DIR}/empty3.h" + INTERFACE FILE_SET g TYPE HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/dir1" "${CMAKE_CURRENT_SOURCE_DIR}/dir2" FILES "${CMAKE_CURRENT_SOURCE_DIR}/dir1/file1.h" "${CMAKE_CURRENT_SOURCE_DIR}/dir2/file2.h" + INTERFACE FILE_SET dir3 TYPE HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/dir3" FILES dir3/dir3.h + ) + +install(TARGETS lib1 EXPORT export FILE_SET HEADERS FILE_SET a FILE_SET b FILE_SET c DESTINATION include/dir FILE_SET d FILE_SET e FILE_SET f DESTINATION include/$<IF:$<CONFIG:Debug>,debug,release> FILE_SET g FILE_SET dir3 DESTINATION include/dir3) +install(EXPORT export FILE export.cmake NAMESPACE install:: DESTINATION lib/cmake) +export(EXPORT export FILE export.cmake NAMESPACE export::) + +add_library(lib2 STATIC lib2.c) +target_link_libraries(lib2 PRIVATE lib1) diff --git a/Tests/RunCMake/target_sources/FileSetFileNoExist-result.txt b/Tests/RunCMake/target_sources/FileSetFileNoExist-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetFileNoExist-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetFileNoExist-stderr.txt b/Tests/RunCMake/target_sources/FileSetFileNoExist-stderr.txt new file mode 100644 index 0000000..9a2ca6a --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetFileNoExist-stderr.txt @@ -0,0 +1,10 @@ +^CMake Error at FileSetFileNoExist\.cmake:[0-9]+ \(add_library\): + Cannot find source file: + + [^ +]*/Tests/RunCMake/target_sources/noexist\.h +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/target_sources/FileSetFileNoExist.cmake b/Tests/RunCMake/target_sources/FileSetFileNoExist.cmake new file mode 100644 index 0000000..0df8186 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetFileNoExist.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 PRIVATE FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES noexist.h) diff --git a/Tests/RunCMake/target_sources/FileSetImport.cmake b/Tests/RunCMake/target_sources/FileSetImport.cmake new file mode 100644 index 0000000..9c7358a --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetImport.cmake @@ -0,0 +1,97 @@ +enable_language(C) + +get_property(_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + +function(assert_prop_eq tgt prop value) + unset(actual_value) + get_property(actual_value TARGET ${tgt} PROPERTY ${prop}) + if(NOT actual_value STREQUAL value) + message(SEND_ERROR "Expected value of ${prop}:\n ${value}\nActual value:\n ${actual_value}") + endif() +endfunction() + +get_filename_component(export_build_dir "${CMAKE_BINARY_DIR}" DIRECTORY) +string(APPEND export_build_dir "/FileSetExport-build") + +include("${export_build_dir}/export.cmake") +include("${export_build_dir}/install/lib/cmake/export.cmake") + +assert_prop_eq(export::lib1 HEADER_SETS "") +assert_prop_eq(export::lib1 INTERFACE_HEADER_SETS "HEADERS;b;c;d;e;f;g;dir3") +assert_prop_eq(export::lib1 HEADER_SET "${CMAKE_CURRENT_SOURCE_DIR}/error.c") +assert_prop_eq(export::lib1 HEADER_DIRS "${CMAKE_CURRENT_SOURCE_DIR}") +assert_prop_eq(export::lib1 HEADER_SET_b "${CMAKE_CURRENT_SOURCE_DIR}/h2.h") +assert_prop_eq(export::lib1 HEADER_DIRS_b "${CMAKE_CURRENT_SOURCE_DIR}") +assert_prop_eq(export::lib1 HEADER_SET_c "$<1:dir/dir.h>") +assert_prop_eq(export::lib1 HEADER_DIRS_c "$<1:${CMAKE_CURRENT_SOURCE_DIR}/dir>") +assert_prop_eq(export::lib1 HEADER_SET_d "${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>/empty.h") +assert_prop_eq(export::lib1 HEADER_DIRS_d "${CMAKE_CURRENT_SOURCE_DIR}") +assert_prop_eq(export::lib1 HEADER_SET_e "${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>/empty2.h") +assert_prop_eq(export::lib1 HEADER_DIRS_e "${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>") +assert_prop_eq(export::lib1 HEADER_SET_f "${CMAKE_CURRENT_SOURCE_DIR}/empty3.h") +assert_prop_eq(export::lib1 HEADER_DIRS_f "${CMAKE_CURRENT_SOURCE_DIR}") +assert_prop_eq(export::lib1 HEADER_SET_g "${CMAKE_CURRENT_SOURCE_DIR}/dir1/file1.h;${CMAKE_CURRENT_SOURCE_DIR}/dir2/file2.h") +assert_prop_eq(export::lib1 HEADER_DIRS_g "${CMAKE_CURRENT_SOURCE_DIR}/dir1;${CMAKE_CURRENT_SOURCE_DIR}/dir2") +assert_prop_eq(export::lib1 INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR};$<1:${CMAKE_CURRENT_SOURCE_DIR}/dir>;${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>;${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/dir1;${CMAKE_CURRENT_SOURCE_DIR}/dir2;${CMAKE_CURRENT_SOURCE_DIR}/dir3;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:$<1:${CMAKE_CURRENT_SOURCE_DIR}/dir>>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir1>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir2>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir3>") + +assert_prop_eq(install::lib1 HEADER_SETS "") +assert_prop_eq(install::lib1 INTERFACE_HEADER_SETS "HEADERS;b;c;d;e;f;g;dir3") +assert_prop_eq(install::lib1 HEADER_SET "${export_build_dir}/install/include/error.c") +assert_prop_eq(install::lib1 HEADER_DIRS "${export_build_dir}/install/include") +assert_prop_eq(install::lib1 HEADER_SET_b "${export_build_dir}/install/include/h2.h") +assert_prop_eq(install::lib1 HEADER_DIRS_b "${export_build_dir}/install/include") +assert_prop_eq(install::lib1 HEADER_SET_c "${export_build_dir}/install/include/dir/dir.h") +assert_prop_eq(install::lib1 HEADER_DIRS_c "${export_build_dir}/install/include/dir") +if(_multi_config) + assert_prop_eq(install::lib1 HEADER_SET_d "$<$<CONFIG:Debug>:${export_build_dir}/install/include/debug/empty.h>;$<$<CONFIG:Release>:${export_build_dir}/install/include/release/empty.h>") +else() + assert_prop_eq(install::lib1 HEADER_SET_d "${export_build_dir}/install/include/debug/empty.h") +endif() +assert_prop_eq(install::lib1 HEADER_DIRS_d "${export_build_dir}/install/include") +if(_multi_config) + assert_prop_eq(install::lib1 HEADER_SET_e "$<$<CONFIG:Debug>:${export_build_dir}/install/include/empty2.h>;$<$<CONFIG:Release>:${export_build_dir}/install/include/empty2.h>") +else() + assert_prop_eq(install::lib1 HEADER_SET_e "${export_build_dir}/install/include/empty2.h") +endif() +assert_prop_eq(install::lib1 HEADER_DIRS_e "${export_build_dir}/install/include") +if(_multi_config) + assert_prop_eq(install::lib1 HEADER_SET_f "$<$<CONFIG:Debug>:${export_build_dir}/install/include/debug/empty3.h>;$<$<CONFIG:Release>:${export_build_dir}/install/include/release/empty3.h>") + assert_prop_eq(install::lib1 HEADER_DIRS_f "$<$<CONFIG:Debug>:${export_build_dir}/install/include/debug>;$<$<CONFIG:Release>:${export_build_dir}/install/include/release>") +else() + assert_prop_eq(install::lib1 HEADER_SET_f "${export_build_dir}/install/include/debug/empty3.h") + assert_prop_eq(install::lib1 HEADER_DIRS_f "${export_build_dir}/install/include/debug") +endif() +assert_prop_eq(install::lib1 HEADER_SET_g "${export_build_dir}/install/include/file1.h;${export_build_dir}/install/include/file2.h") +assert_prop_eq(install::lib1 HEADER_DIRS_g "${export_build_dir}/install/include") +if(_multi_config) + assert_prop_eq(install::lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include/dir>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:$<$<CONFIG:Debug>:${export_build_dir}/install/include/debug>>;$<BUILD_INTERFACE:$<$<CONFIG:Release>:${export_build_dir}/install/include/release>>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include/dir3>") +else() + assert_prop_eq(install::lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include/dir>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include/debug>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include/dir3>") +endif() + +file(GLOB_RECURSE actual + LIST_DIRECTORIES TRUE + RELATIVE "${CMAKE_BINARY_DIR}/../FileSetExport-build/install/include" + "${CMAKE_BINARY_DIR}/../FileSetExport-build/install/include/*" + ) +if(actual) + list(SORT actual) +endif() +if(_multi_config) + set(expect "^debug;debug/empty\\.h;debug/empty3\\.h;dir;dir/dir\\.h;dir3;dir3/dir3\.h;empty2\\.h;error\\.c;file1\\.h;file2\\.h;h2\\.h;release;release/empty\\.h;release/empty3\\.h$") +else() + set(expect "^debug;debug/empty\\.h;debug/empty3\\.h;dir;dir/dir\\.h;dir3;dir3/dir3\.h;empty2\\.h;error\\.c;file1\\.h;file2\\.h;h2\\.h$") +endif() +if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "Installed files: + ${actual} +do not match what we expected: + ${expect} +in directory: + ${CMAKE_INSTALL_PREFIX}") +endif() + +add_library(lib2_export STATIC lib2.c) +target_link_libraries(lib2_export PRIVATE export::lib1) +add_library(lib2_install STATIC lib2.c) +target_link_libraries(lib2_install PRIVATE install::lib1) diff --git a/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface-result.txt b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface-stderr.txt b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface-stderr.txt new file mode 100644 index 0000000..694f227 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at FileSetInstallMissingSetsInterface\.cmake:[0-9]+ \(install\): + install TARGETS target lib1 is exported but not all of its file sets are + installed +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface.cmake b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface.cmake new file mode 100644 index 0000000..face69e --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface.cmake @@ -0,0 +1,5 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 INTERFACE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h) +install(TARGETS lib1 EXPORT a) diff --git a/Tests/RunCMake/target_sources/FileSetInstallMissingSetsPrivate.cmake b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsPrivate.cmake new file mode 100644 index 0000000..84778d1 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsPrivate.cmake @@ -0,0 +1,9 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h) +install(TARGETS lib1 EXPORT a) + +add_library(lib2 STATIC empty.c) +target_sources(lib2 INTERFACE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h) +install(TARGETS lib2) diff --git a/Tests/RunCMake/target_sources/FileSetNoExistInterface-result.txt b/Tests/RunCMake/target_sources/FileSetNoExistInterface-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoExistInterface-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetNoExistInterface-stderr.txt b/Tests/RunCMake/target_sources/FileSetNoExistInterface-stderr.txt new file mode 100644 index 0000000..3972c89 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoExistInterface-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FileSetNoExistInterface\.cmake:[0-9]+ \(set_property\): + Header set "a" has not yet been created\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetNoExistInterface.cmake b/Tests/RunCMake/target_sources/FileSetNoExistInterface.cmake new file mode 100644 index 0000000..266bc61 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoExistInterface.cmake @@ -0,0 +1,7 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +set_property(TARGET lib1 PROPERTY INTERFACE_HEADER_SETS "a") + +# Error happens at configure-time, so this doesn't help. +target_sources(lib1 INTERFACE FILE_SET a TYPE HEADERS) diff --git a/Tests/RunCMake/target_sources/FileSetNoExistPrivate-result.txt b/Tests/RunCMake/target_sources/FileSetNoExistPrivate-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoExistPrivate-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetNoExistPrivate-stderr.txt b/Tests/RunCMake/target_sources/FileSetNoExistPrivate-stderr.txt new file mode 100644 index 0000000..336bafe --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoExistPrivate-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FileSetNoExistPrivate\.cmake:[0-9]+ \(set_property\): + Header set "a" has not yet been created\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetNoExistPrivate.cmake b/Tests/RunCMake/target_sources/FileSetNoExistPrivate.cmake new file mode 100644 index 0000000..f501912 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoExistPrivate.cmake @@ -0,0 +1,7 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +set_property(TARGET lib1 PROPERTY HEADER_SETS "a") + +# Error happens at configure-time, so this doesn't help. +target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS) diff --git a/Tests/RunCMake/target_sources/FileSetNoScope-result.txt b/Tests/RunCMake/target_sources/FileSetNoScope-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoScope-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetNoScope-stderr.txt b/Tests/RunCMake/target_sources/FileSetNoScope-stderr.txt new file mode 100644 index 0000000..835ffe7 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoScope-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FileSetNoScope\.cmake:[0-9]+ \(target_sources\): + target_sources File set "a" is not in HEADER_SETS or INTERFACE_HEADER_SETS +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetNoScope.cmake b/Tests/RunCMake/target_sources/FileSetNoScope.cmake new file mode 100644 index 0000000..79ff341 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoScope.cmake @@ -0,0 +1,6 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h) +set_property(TARGET lib1 PROPERTY HEADER_SETS) +target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS FILES h2.h) diff --git a/Tests/RunCMake/target_sources/FileSetNoType-result.txt b/Tests/RunCMake/target_sources/FileSetNoType-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoType-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetNoType-stderr.txt b/Tests/RunCMake/target_sources/FileSetNoType-stderr.txt new file mode 100644 index 0000000..5405fdb --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoType-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FileSetNoType\.cmake:[0-9]+ \(target_sources\): + target_sources Must specify a TYPE when creating file set +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetNoType.cmake b/Tests/RunCMake/target_sources/FileSetNoType.cmake new file mode 100644 index 0000000..961525d --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetNoType.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 PRIVATE FILE_SET a) diff --git a/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs-result.txt b/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs-stderr.txt b/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs-stderr.txt new file mode 100644 index 0000000..551b9e7 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at FileSetOverlappingBaseDirs\.cmake:[0-9]+ \(target_sources\): + Base directories in file set cannot be subdirectories of each other: + + [^ +]*/Tests/RunCMake/target_sources/\. + [^ +]*/Tests/RunCMake/target_sources/dir3 +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs.cmake b/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs.cmake new file mode 100644 index 0000000..eba4191 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS BASE_DIRS $<1:${CMAKE_CURRENT_SOURCE_DIR}/.$<SEMICOLON>${CMAKE_CURRENT_SOURCE_DIR}/dir3> FILES h1.h) diff --git a/Tests/RunCMake/target_sources/FileSetProperties.cmake b/Tests/RunCMake/target_sources/FileSetProperties.cmake new file mode 100644 index 0000000..ce010a3 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetProperties.cmake @@ -0,0 +1,67 @@ +enable_language(C) + +function(assert_prop_undef tgt prop) + unset(actual_value) + get_property(actual_value TARGET ${tgt} PROPERTY ${prop}) + if(DEFINED actual_value) + message(SEND_ERROR "${prop} should be undefined, actual value:\n ${actual_value}") + endif() +endfunction() + +function(assert_prop_eq tgt prop value) + unset(actual_value) + get_property(actual_value TARGET ${tgt} PROPERTY ${prop}) + if(NOT actual_value STREQUAL value) + message(SEND_ERROR "Expected value of ${prop}:\n ${value}\nActual value:\n ${actual_value}") + endif() +endfunction() + +add_library(lib1 STATIC empty.c) +assert_prop_eq(lib1 HEADER_SETS "") +assert_prop_eq(lib1 INTERFACE_HEADER_SETS "") +assert_prop_undef(lib1 INCLUDE_DIRECTORIES) +assert_prop_undef(lib1 INTERFACE_INCLUDE_DIRECTORIES) + +target_sources(lib1 PUBLIC FILE_SET a TYPE HEADERS BASE_DIRS "." FILES h1.h h2.h) +assert_prop_eq(lib1 HEADER_SETS "a") +assert_prop_eq(lib1 INTERFACE_HEADER_SETS "a") +assert_prop_eq(lib1 HEADER_DIRS_a "${CMAKE_CURRENT_SOURCE_DIR}/.") +assert_prop_eq(lib1 HEADER_SET_a "${CMAKE_CURRENT_SOURCE_DIR}/h1.h;${CMAKE_CURRENT_SOURCE_DIR}/h2.h") +assert_prop_eq(lib1 INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>") +assert_prop_eq(lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>") + +target_sources(lib1 PUBLIC FILE_SET a FILES h3.h) +assert_prop_eq(lib1 HEADER_SETS "a") +assert_prop_eq(lib1 INTERFACE_HEADER_SETS "a") +assert_prop_eq(lib1 HEADER_DIRS_a "${CMAKE_CURRENT_SOURCE_DIR}/.") +assert_prop_eq(lib1 HEADER_SET_a "${CMAKE_CURRENT_SOURCE_DIR}/h1.h;${CMAKE_CURRENT_SOURCE_DIR}/h2.h;${CMAKE_CURRENT_SOURCE_DIR}/h3.h") +assert_prop_eq(lib1 INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>") +assert_prop_eq(lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>") + +target_sources(lib1 PRIVATE FILE_SET b TYPE HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/dir" FILES dir/dir.h) +assert_prop_eq(lib1 HEADER_SETS "a;b") +assert_prop_eq(lib1 INTERFACE_HEADER_SETS "a") +assert_prop_eq(lib1 HEADER_DIRS_b "${CMAKE_CURRENT_SOURCE_DIR}/dir") +assert_prop_eq(lib1 HEADER_SET_b "${CMAKE_CURRENT_SOURCE_DIR}/dir/dir.h") +assert_prop_eq(lib1 INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir>") +assert_prop_eq(lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>") + +target_sources(lib1 INTERFACE FILE_SET c TYPE HEADERS) +assert_prop_eq(lib1 HEADER_SETS "a;b") +assert_prop_eq(lib1 INTERFACE_HEADER_SETS "a;c") +assert_prop_eq(lib1 HEADER_DIRS_c "${CMAKE_CURRENT_SOURCE_DIR}") +assert_prop_eq(lib1 HEADER_SET_c "") +assert_prop_eq(lib1 INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir>") +assert_prop_eq(lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>") + +target_sources(lib1 PUBLIC FILE_SET HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES h1.h) +assert_prop_eq(lib1 HEADER_DIRS "${CMAKE_CURRENT_SOURCE_DIR}") +assert_prop_eq(lib1 HEADER_SET "${CMAKE_CURRENT_SOURCE_DIR}/h1.h") +assert_prop_eq(lib1 INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>") +assert_prop_eq(lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>") + +target_sources(lib1 PUBLIC FILE_SET HEADERS FILES h2.h) +assert_prop_eq(lib1 HEADER_DIRS "${CMAKE_CURRENT_SOURCE_DIR}") +assert_prop_eq(lib1 HEADER_SET "${CMAKE_CURRENT_SOURCE_DIR}/h1.h;${CMAKE_CURRENT_SOURCE_DIR}/h2.h") +assert_prop_eq(lib1 INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>") +assert_prop_eq(lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>") diff --git a/Tests/RunCMake/target_sources/FileSetWrongBaseDirs-result.txt b/Tests/RunCMake/target_sources/FileSetWrongBaseDirs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetWrongBaseDirs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetWrongBaseDirs-stderr.txt b/Tests/RunCMake/target_sources/FileSetWrongBaseDirs-stderr.txt new file mode 100644 index 0000000..f4bd447 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetWrongBaseDirs-stderr.txt @@ -0,0 +1,12 @@ +CMake Error at FileSetWrongBaseDirs\.cmake:[0-9]+ \(target_sources\): + File: + + [^ +]*/Tests/RunCMake/target_sources/h1\.h + + must be in one of the file set's base directories: + + [^ +]*/Tests/RunCMake/target_sources/dir3 +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_sources/FileSetWrongBaseDirs.cmake b/Tests/RunCMake/target_sources/FileSetWrongBaseDirs.cmake new file mode 100644 index 0000000..38d3abd --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetWrongBaseDirs.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/dir3 FILES h1.h) diff --git a/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative-result.txt b/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative-stderr.txt b/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative-stderr.txt new file mode 100644 index 0000000..6bb0ec6 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at reldir/CMakeLists\.txt:[0-9]+ \(target_sources\): + File: + + [^ +]*/Tests/RunCMake/target_sources/reldir/\.\./h1\.h + + must be in one of the file set's base directories: + + [^ +]*/Tests/RunCMake/target_sources/reldir/\. diff --git a/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative.cmake b/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative.cmake new file mode 100644 index 0000000..2ca8a8e --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative.cmake @@ -0,0 +1,3 @@ +enable_language(C) + +add_subdirectory(reldir) diff --git a/Tests/RunCMake/target_sources/FileSetWrongType-result.txt b/Tests/RunCMake/target_sources/FileSetWrongType-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetWrongType-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetWrongType-stderr.txt b/Tests/RunCMake/target_sources/FileSetWrongType-stderr.txt new file mode 100644 index 0000000..8ffa786 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetWrongType-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FileSetWrongType\.cmake:[0-9]+ \(target_sources\): + target_sources File set TYPE may only be "HEADERS" +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetWrongType.cmake b/Tests/RunCMake/target_sources/FileSetWrongType.cmake new file mode 100644 index 0000000..b7dee72 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetWrongType.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +target_sources(lib1 PRIVATE FILE_SET a TYPE UNKNOWN) diff --git a/Tests/RunCMake/target_sources/RunCMakeTest.cmake b/Tests/RunCMake/target_sources/RunCMakeTest.cmake index 9d64927..9828fa2 100644 --- a/Tests/RunCMake/target_sources/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_sources/RunCMakeTest.cmake @@ -21,3 +21,60 @@ run_cmake(AddCustomTargetInterfaceSources) run_cmake(AddCustomTargetSources) run_cmake(AddCustomTargetCheckProperty) run_cmake(AddCustomTargetGenx) + +run_cmake(FileSetProperties) +run_cmake(FileSetNoType) +run_cmake(FileSetWrongType) +run_cmake(FileSetDefaultWrongType) +run_cmake(FileSetChangeScope) +run_cmake(FileSetChangeType) +run_cmake(FileSetWrongBaseDirs) +run_cmake(FileSetWrongBaseDirsRelative) +run_cmake(FileSetOverlappingBaseDirs) +run_cmake(FileSetInstallMissingSetsPrivate) +run_cmake(FileSetInstallMissingSetsInterface) +run_cmake(FileSetNoScope) +run_cmake(FileSetNoExistPrivate) +run_cmake(FileSetNoExistInterface) +run_cmake(FileSetDirectories) + +set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0115=NEW) +run_cmake(FileSetFileNoExist) +unset(RunCMake_TEST_OPTIONS) + +function(run_export_import name) + if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(_config_options "-DCMAKE_CONFIGURATION_TYPES=Debug\\\\;Release") + else() + set(_config_options -DCMAKE_BUILD_TYPE=Debug) + endif() + + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${name}Export-build") + set(RunCMake_TEST_OPTIONS "--install-prefix=${RunCMake_TEST_BINARY_DIR}/install" ${_config_options}) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${name}Export) + run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --build . --config Debug) + run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --install . --config Debug) + if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --build . --config Release) + run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --install . --config Release) + endif() + unset(RunCMake_TEST_OPTIONS) + + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${name}Import-build") + unset(RunCMake_TEST_OPTIONS) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${name}Import) + run_cmake_command(${name}Import-build ${CMAKE_COMMAND} --build . --config Debug) + if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + run_cmake_command(${name}Import-build ${CMAKE_COMMAND} --build . --config Release) + endif() + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) +endfunction() + +run_export_import(FileSet) diff --git a/Tests/RunCMake/target_sources/debug/empty.h b/Tests/RunCMake/target_sources/debug/empty.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/debug/empty.h diff --git a/Tests/RunCMake/target_sources/debug/empty2.h b/Tests/RunCMake/target_sources/debug/empty2.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/debug/empty2.h diff --git a/Tests/RunCMake/target_sources/dir/dir.h b/Tests/RunCMake/target_sources/dir/dir.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/dir/dir.h diff --git a/Tests/RunCMake/target_sources/dir1/file1.h b/Tests/RunCMake/target_sources/dir1/file1.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/dir1/file1.h diff --git a/Tests/RunCMake/target_sources/dir2/file2.h b/Tests/RunCMake/target_sources/dir2/file2.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/dir2/file2.h diff --git a/Tests/RunCMake/target_sources/dir3/CMakeLists.txt b/Tests/RunCMake/target_sources/dir3/CMakeLists.txt new file mode 100644 index 0000000..e23ceb8 --- /dev/null +++ b/Tests/RunCMake/target_sources/dir3/CMakeLists.txt @@ -0,0 +1 @@ +add_library(lib1 STATIC ../empty.c) diff --git a/Tests/RunCMake/target_sources/dir3/dir3.h b/Tests/RunCMake/target_sources/dir3/dir3.h new file mode 100644 index 0000000..e45c25a --- /dev/null +++ b/Tests/RunCMake/target_sources/dir3/dir3.h @@ -0,0 +1,4 @@ +#ifndef DIR3_H +#define DIR3_H + +#endif diff --git a/Tests/RunCMake/target_sources/dir4/CMakeLists.txt b/Tests/RunCMake/target_sources/dir4/CMakeLists.txt new file mode 100644 index 0000000..6475685 --- /dev/null +++ b/Tests/RunCMake/target_sources/dir4/CMakeLists.txt @@ -0,0 +1,4 @@ +target_sources(lib1 PRIVATE FILE_SET HEADERS BASE_DIRS ${CMAKE_SOURCE_DIR} FILES + $<1:dir3.h> + dir4.h + ) diff --git a/Tests/RunCMake/target_sources/dir4/dir4.h b/Tests/RunCMake/target_sources/dir4/dir4.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/dir4/dir4.h diff --git a/Tests/RunCMake/target_sources/empty.c b/Tests/RunCMake/target_sources/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/empty.c diff --git a/Tests/RunCMake/target_sources/empty3.h b/Tests/RunCMake/target_sources/empty3.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/empty3.h diff --git a/Tests/RunCMake/target_sources/error.c b/Tests/RunCMake/target_sources/error.c new file mode 100644 index 0000000..f10e687 --- /dev/null +++ b/Tests/RunCMake/target_sources/error.c @@ -0,0 +1 @@ +#error "This should not be compiled" diff --git a/Tests/RunCMake/target_sources/h1.h b/Tests/RunCMake/target_sources/h1.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/h1.h diff --git a/Tests/RunCMake/target_sources/h2.h b/Tests/RunCMake/target_sources/h2.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/h2.h diff --git a/Tests/RunCMake/target_sources/h3.h b/Tests/RunCMake/target_sources/h3.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/h3.h diff --git a/Tests/RunCMake/target_sources/lib1.c b/Tests/RunCMake/target_sources/lib1.c new file mode 100644 index 0000000..95042de --- /dev/null +++ b/Tests/RunCMake/target_sources/lib1.c @@ -0,0 +1,6 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + void lib1(void) +{ +} diff --git a/Tests/RunCMake/target_sources/lib2.c b/Tests/RunCMake/target_sources/lib2.c new file mode 100644 index 0000000..a060dc9 --- /dev/null +++ b/Tests/RunCMake/target_sources/lib2.c @@ -0,0 +1,8 @@ +#include <dir3.h> + +#ifdef _WIN32 +__declspec(dllexport) +#endif + void lib2(void) +{ +} diff --git a/Tests/RunCMake/target_sources/reldir/CMakeLists.txt b/Tests/RunCMake/target_sources/reldir/CMakeLists.txt new file mode 100644 index 0000000..df22b25 --- /dev/null +++ b/Tests/RunCMake/target_sources/reldir/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library(lib1 STATIC ../empty.c) +target_sources(lib1 PRIVATE FILE_SET HEADERS BASE_DIRS . FILES ../h1.h) diff --git a/Tests/RunCMake/target_sources/release/empty.h b/Tests/RunCMake/target_sources/release/empty.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/release/empty.h diff --git a/Tests/RunCMake/target_sources/release/empty2.h b/Tests/RunCMake/target_sources/release/empty2.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_sources/release/empty2.h |