diff options
author | Deniz Bahadir <dbahadir@benocs.com> | 2017-09-14 16:48:13 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-09-20 11:35:09 (GMT) |
commit | 55ed21e72e5f1b44e1769e9ad1bfd0a6b46555ce (patch) | |
tree | d3842b8e6e45c43a035f9e59190790866ed95e3f /Tests/RunCMake | |
parent | 90b931e115fa6da965135a3a2160e2efbeac2379 (diff) | |
download | CMake-55ed21e72e5f1b44e1769e9ad1bfd0a6b46555ce.zip CMake-55ed21e72e5f1b44e1769e9ad1bfd0a6b46555ce.tar.gz CMake-55ed21e72e5f1b44e1769e9ad1bfd0a6b46555ce.tar.bz2 |
Tests: Add tests for missing sources in add_executable and add_library.
Diffstat (limited to 'Tests/RunCMake')
59 files changed, 209 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 88952e1..73fa8fb 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -180,6 +180,8 @@ add_RunCMake_test(Syntax) add_RunCMake_test(add_custom_command) add_RunCMake_test(add_custom_target) add_RunCMake_test(add_dependencies) +add_RunCMake_test(add_executable) +add_RunCMake_test(add_library) add_RunCMake_test(add_subdirectory) add_RunCMake_test(build_command) add_executable(exit_code exit_code.c) diff --git a/Tests/RunCMake/add_executable/CMakeLists.txt b/Tests/RunCMake/add_executable/CMakeLists.txt new file mode 100644 index 0000000..ef2163c --- /dev/null +++ b/Tests/RunCMake/add_executable/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/add_executable/NoSources-result.txt b/Tests/RunCMake/add_executable/NoSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_executable/NoSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_executable/NoSources-stderr.txt b/Tests/RunCMake/add_executable/NoSources-stderr.txt new file mode 100644 index 0000000..5985905 --- /dev/null +++ b/Tests/RunCMake/add_executable/NoSources-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NoSources.cmake:[0-9]+ \(add_executable\): + add_executable called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_executable/NoSources.cmake b/Tests/RunCMake/add_executable/NoSources.cmake new file mode 100644 index 0000000..563564a --- /dev/null +++ b/Tests/RunCMake/add_executable/NoSources.cmake @@ -0,0 +1 @@ +add_executable(TestExeWithoutSources) diff --git a/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-result.txt b/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-stderr.txt new file mode 100644 index 0000000..c8afadb --- /dev/null +++ b/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-stderr.txt @@ -0,0 +1,11 @@ +^CMake Error at NoSourcesButLinkObjects.cmake:[0-9]+ \(add_executable\): + add_executable called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Error at NoSourcesButLinkObjects.cmake:[0-9]+ \(target_link_libraries\): + Cannot specify link libraries for target \"TestExeWithoutSources\" which is + not built by this project. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_executable/NoSourcesButLinkObjects.cmake b/Tests/RunCMake/add_executable/NoSourcesButLinkObjects.cmake new file mode 100644 index 0000000..d0f2093 --- /dev/null +++ b/Tests/RunCMake/add_executable/NoSourcesButLinkObjects.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_executable(TestExeWithoutSources) +target_link_libraries(TestExeWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_executable/OnlyObjectSources-result.txt b/Tests/RunCMake/add_executable/OnlyObjectSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_executable/OnlyObjectSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_executable/OnlyObjectSources-stderr.txt b/Tests/RunCMake/add_executable/OnlyObjectSources-stderr.txt new file mode 100644 index 0000000..ea72d5d --- /dev/null +++ b/Tests/RunCMake/add_executable/OnlyObjectSources-stderr.txt @@ -0,0 +1,11 @@ +^CMake Error at OnlyObjectSources.cmake:[0-9]+ \(add_executable\): + add_executable called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Error at OnlyObjectSources.cmake:[0-9]+ \(target_sources\): + Cannot specify sources for target \"TestExeWithoutSources\" which is not + built by this project. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_executable/OnlyObjectSources.cmake b/Tests/RunCMake/add_executable/OnlyObjectSources.cmake new file mode 100644 index 0000000..1c90e9a --- /dev/null +++ b/Tests/RunCMake/add_executable/OnlyObjectSources.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_executable(TestExeWithoutSources) +target_sources(TestExeWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_executable/RunCMakeTest.cmake b/Tests/RunCMake/add_executable/RunCMakeTest.cmake new file mode 100644 index 0000000..70a68f2 --- /dev/null +++ b/Tests/RunCMake/add_executable/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(NoSources) +run_cmake(OnlyObjectSources) +run_cmake(NoSourcesButLinkObjects) diff --git a/Tests/RunCMake/add_executable/test.cpp b/Tests/RunCMake/add_executable/test.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/add_executable/test.cpp diff --git a/Tests/RunCMake/add_library/CMakeLists.txt b/Tests/RunCMake/add_library/CMakeLists.txt new file mode 100644 index 0000000..ef2163c --- /dev/null +++ b/Tests/RunCMake/add_library/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/add_library/INTERFACEwithNoSources.cmake b/Tests/RunCMake/add_library/INTERFACEwithNoSources.cmake new file mode 100644 index 0000000..79188f3 --- /dev/null +++ b/Tests/RunCMake/add_library/INTERFACEwithNoSources.cmake @@ -0,0 +1 @@ +add_library(TestInterfaceLibWithoutSources INTERFACE) diff --git a/Tests/RunCMake/add_library/INTERFACEwithNoSourcesButLinkObjects.cmake b/Tests/RunCMake/add_library/INTERFACEwithNoSourcesButLinkObjects.cmake new file mode 100644 index 0000000..53a48f0 --- /dev/null +++ b/Tests/RunCMake/add_library/INTERFACEwithNoSourcesButLinkObjects.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestInterfaceLibWithoutSources INTERFACE) +target_link_libraries(TestInterfaceLibWithoutSources INTERFACE $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/INTERFACEwithOnlyObjectSources.cmake b/Tests/RunCMake/add_library/INTERFACEwithOnlyObjectSources.cmake new file mode 100644 index 0000000..86fab1d --- /dev/null +++ b/Tests/RunCMake/add_library/INTERFACEwithOnlyObjectSources.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestInterfaceLibWithoutSources INTERFACE) +target_sources(TestInterfaceLibWithoutSources INTERFACE $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/MODULEwithNoSources-result.txt b/Tests/RunCMake/add_library/MODULEwithNoSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_library/MODULEwithNoSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_library/MODULEwithNoSources-stderr.txt b/Tests/RunCMake/add_library/MODULEwithNoSources-stderr.txt new file mode 100644 index 0000000..5cf0b1e --- /dev/null +++ b/Tests/RunCMake/add_library/MODULEwithNoSources-stderr.txt @@ -0,0 +1,3 @@ +^You have called ADD_LIBRARY for library TestModuleLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file( +CMake Error: CMake can not determine linker language for target: TestModuleLibWithoutSources)+( +CMake Error: Cannot determine link language for target \"TestModuleLibWithoutSources\".)?$ diff --git a/Tests/RunCMake/add_library/MODULEwithNoSources.cmake b/Tests/RunCMake/add_library/MODULEwithNoSources.cmake new file mode 100644 index 0000000..5df5033 --- /dev/null +++ b/Tests/RunCMake/add_library/MODULEwithNoSources.cmake @@ -0,0 +1 @@ +add_library(TestModuleLibWithoutSources MODULE) diff --git a/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-result.txt b/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-stderr.txt new file mode 100644 index 0000000..951594a --- /dev/null +++ b/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-stderr.txt @@ -0,0 +1,3 @@ +^You have called ADD_LIBRARY for library TestModuleLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file( +CMake Error: CMake can not determine linker language for target: TestModuleLibWithoutSources)+( +CMake Error: Cannot determine link language for target \"TestModuleLibWithoutSources\".)*$ diff --git a/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects.cmake b/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects.cmake new file mode 100644 index 0000000..f9d00de --- /dev/null +++ b/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestModuleLibWithoutSources MODULE) +target_link_libraries(TestModuleLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/MODULEwithOnlyObjectSources-stderr.txt b/Tests/RunCMake/add_library/MODULEwithOnlyObjectSources-stderr.txt new file mode 100644 index 0000000..de83755 --- /dev/null +++ b/Tests/RunCMake/add_library/MODULEwithOnlyObjectSources-stderr.txt @@ -0,0 +1 @@ +^You have called ADD_LIBRARY for library TestModuleLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file$ diff --git a/Tests/RunCMake/add_library/MODULEwithOnlyObjectSources.cmake b/Tests/RunCMake/add_library/MODULEwithOnlyObjectSources.cmake new file mode 100644 index 0000000..187481a --- /dev/null +++ b/Tests/RunCMake/add_library/MODULEwithOnlyObjectSources.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestModuleLibWithoutSources MODULE) +target_sources(TestModuleLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSources-result.txt b/Tests/RunCMake/add_library/OBJECTwithNoSources-result.txt new file mode 100644 index 0000000..9c558e3 --- /dev/null +++ b/Tests/RunCMake/add_library/OBJECTwithNoSources-result.txt @@ -0,0 +1 @@ +. diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSources-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithNoSources-stderr.txt new file mode 100644 index 0000000..099ec4f --- /dev/null +++ b/Tests/RunCMake/add_library/OBJECTwithNoSources-stderr.txt @@ -0,0 +1,2 @@ +^You have called ADD_LIBRARY for library TestObjectLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file( +CMake Error: CMake can not determine linker language for target: TestObjectLibWithoutSources)*$ diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSources.cmake b/Tests/RunCMake/add_library/OBJECTwithNoSources.cmake new file mode 100644 index 0000000..742e829 --- /dev/null +++ b/Tests/RunCMake/add_library/OBJECTwithNoSources.cmake @@ -0,0 +1 @@ +add_library(TestObjectLibWithoutSources OBJECT) diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-result.txt b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt new file mode 100644 index 0000000..8f20096 --- /dev/null +++ b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt @@ -0,0 +1,6 @@ +^You have called ADD_LIBRARY for library TestObjectLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file +CMake Error at OBJECTwithNoSourcesButLinkObjects.cmake:[0-9]+ \(target_link_libraries\): + Object library target \"TestObjectLibWithoutSources\" may not link to + anything. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects.cmake b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects.cmake new file mode 100644 index 0000000..6b4b55f --- /dev/null +++ b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestObjectLibWithoutSources OBJECT) +target_link_libraries(TestObjectLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-result.txt b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt new file mode 100644 index 0000000..f9cbf6b --- /dev/null +++ b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt @@ -0,0 +1,17 @@ +^You have called ADD_LIBRARY for library TestObjectLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file +CMake Error at OBJECTwithOnlyObjectSources.cmake:[0-9]+ \(add_library\): + OBJECT library \"TestObjectLibWithoutSources\" contains: + + [^ +]*test(\.cpp)?\.o(bj)? + + but may contain only sources that compile, header files, and other files + that would not affect linking of a normal library. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Error at OBJECTwithOnlyObjectSources.cmake:[0-9]+ \(add_library\): + Only executables and non-OBJECT libraries may reference target objects. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources.cmake b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources.cmake new file mode 100644 index 0000000..ff75a8c --- /dev/null +++ b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestObjectLibWithoutSources OBJECT) +target_sources(TestObjectLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/RunCMakeTest.cmake b/Tests/RunCMake/add_library/RunCMakeTest.cmake new file mode 100644 index 0000000..0ba6216 --- /dev/null +++ b/Tests/RunCMake/add_library/RunCMakeTest.cmake @@ -0,0 +1,24 @@ +include(RunCMake) + +run_cmake(INTERFACEwithNoSources) +run_cmake(OBJECTwithNoSources) +run_cmake(STATICwithNoSources) +run_cmake(SHAREDwithNoSources) +run_cmake(MODULEwithNoSources) +run_cmake(UNKNOWNwithNoSources) + +run_cmake(INTERFACEwithOnlyObjectSources) +run_cmake(OBJECTwithOnlyObjectSources) +run_cmake(STATICwithOnlyObjectSources) +run_cmake(SHAREDwithOnlyObjectSources) +run_cmake(MODULEwithOnlyObjectSources) +run_cmake(UNKNOWNwithOnlyObjectSources) + +if(NOT RunCMake_GENERATOR STREQUAL "Xcode" OR NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]") + run_cmake(INTERFACEwithNoSourcesButLinkObjects) + run_cmake(OBJECTwithNoSourcesButLinkObjects) + run_cmake(STATICwithNoSourcesButLinkObjects) + run_cmake(SHAREDwithNoSourcesButLinkObjects) + run_cmake(MODULEwithNoSourcesButLinkObjects) + run_cmake(UNKNOWNwithNoSourcesButLinkObjects) +endif() diff --git a/Tests/RunCMake/add_library/SHAREDwithNoSources-result.txt b/Tests/RunCMake/add_library/SHAREDwithNoSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_library/SHAREDwithNoSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_library/SHAREDwithNoSources-stderr.txt b/Tests/RunCMake/add_library/SHAREDwithNoSources-stderr.txt new file mode 100644 index 0000000..228d1cc --- /dev/null +++ b/Tests/RunCMake/add_library/SHAREDwithNoSources-stderr.txt @@ -0,0 +1,3 @@ +^You have called ADD_LIBRARY for library TestSharedLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file( +CMake Error: CMake can not determine linker language for target: TestSharedLibWithoutSources)+( +CMake Error: Cannot determine link language for target \"TestSharedLibWithoutSources\".)*$ diff --git a/Tests/RunCMake/add_library/SHAREDwithNoSources.cmake b/Tests/RunCMake/add_library/SHAREDwithNoSources.cmake new file mode 100644 index 0000000..e147b44 --- /dev/null +++ b/Tests/RunCMake/add_library/SHAREDwithNoSources.cmake @@ -0,0 +1 @@ +add_library(TestSharedLibWithoutSources SHARED) diff --git a/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-result.txt b/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-stderr.txt new file mode 100644 index 0000000..228d1cc --- /dev/null +++ b/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-stderr.txt @@ -0,0 +1,3 @@ +^You have called ADD_LIBRARY for library TestSharedLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file( +CMake Error: CMake can not determine linker language for target: TestSharedLibWithoutSources)+( +CMake Error: Cannot determine link language for target \"TestSharedLibWithoutSources\".)*$ diff --git a/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects.cmake b/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects.cmake new file mode 100644 index 0000000..5e3c270 --- /dev/null +++ b/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestSharedLibWithoutSources SHARED) +target_link_libraries(TestSharedLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/SHAREDwithOnlyObjectSources-stderr.txt b/Tests/RunCMake/add_library/SHAREDwithOnlyObjectSources-stderr.txt new file mode 100644 index 0000000..ec350cd --- /dev/null +++ b/Tests/RunCMake/add_library/SHAREDwithOnlyObjectSources-stderr.txt @@ -0,0 +1 @@ +^You have called ADD_LIBRARY for library TestSharedLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file$ diff --git a/Tests/RunCMake/add_library/SHAREDwithOnlyObjectSources.cmake b/Tests/RunCMake/add_library/SHAREDwithOnlyObjectSources.cmake new file mode 100644 index 0000000..09281b0 --- /dev/null +++ b/Tests/RunCMake/add_library/SHAREDwithOnlyObjectSources.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestSharedLibWithoutSources SHARED) +target_sources(TestSharedLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/STATICwithNoSources-result.txt b/Tests/RunCMake/add_library/STATICwithNoSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_library/STATICwithNoSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_library/STATICwithNoSources-stderr.txt b/Tests/RunCMake/add_library/STATICwithNoSources-stderr.txt new file mode 100644 index 0000000..830eb22 --- /dev/null +++ b/Tests/RunCMake/add_library/STATICwithNoSources-stderr.txt @@ -0,0 +1,3 @@ +^You have called ADD_LIBRARY for library TestStaticLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file( +CMake Error: Cannot determine link language for target \"TestStaticLibWithoutSources\".)?( +CMake Error: CMake can not determine linker language for target: TestStaticLibWithoutSources)+$ diff --git a/Tests/RunCMake/add_library/STATICwithNoSources.cmake b/Tests/RunCMake/add_library/STATICwithNoSources.cmake new file mode 100644 index 0000000..94a2d9a --- /dev/null +++ b/Tests/RunCMake/add_library/STATICwithNoSources.cmake @@ -0,0 +1 @@ +add_library(TestStaticLibWithoutSources STATIC) diff --git a/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-result.txt b/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-stderr.txt new file mode 100644 index 0000000..830eb22 --- /dev/null +++ b/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-stderr.txt @@ -0,0 +1,3 @@ +^You have called ADD_LIBRARY for library TestStaticLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file( +CMake Error: Cannot determine link language for target \"TestStaticLibWithoutSources\".)?( +CMake Error: CMake can not determine linker language for target: TestStaticLibWithoutSources)+$ diff --git a/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects.cmake b/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects.cmake new file mode 100644 index 0000000..b6e137f --- /dev/null +++ b/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestStaticLibWithoutSources STATIC) +target_link_libraries(TestStaticLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/STATICwithOnlyObjectSources-stderr.txt b/Tests/RunCMake/add_library/STATICwithOnlyObjectSources-stderr.txt new file mode 100644 index 0000000..5cd10d4 --- /dev/null +++ b/Tests/RunCMake/add_library/STATICwithOnlyObjectSources-stderr.txt @@ -0,0 +1 @@ +^You have called ADD_LIBRARY for library TestStaticLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file$ diff --git a/Tests/RunCMake/add_library/STATICwithOnlyObjectSources.cmake b/Tests/RunCMake/add_library/STATICwithOnlyObjectSources.cmake new file mode 100644 index 0000000..74a8947 --- /dev/null +++ b/Tests/RunCMake/add_library/STATICwithOnlyObjectSources.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestStaticLibWithoutSources STATIC) +target_sources(TestStaticLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/UNKNOWNwithNoSources.cmake b/Tests/RunCMake/add_library/UNKNOWNwithNoSources.cmake new file mode 100644 index 0000000..dc5d777 --- /dev/null +++ b/Tests/RunCMake/add_library/UNKNOWNwithNoSources.cmake @@ -0,0 +1 @@ +add_library(TestUnknownLibWithoutSources UNKNOWN IMPORTED) diff --git a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-result.txt b/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-stderr.txt new file mode 100644 index 0000000..adcd3a2 --- /dev/null +++ b/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at UNKNOWNwithNoSourcesButLinkObjects.cmake:[0-9]+ \(target_link_libraries\): + Cannot specify link libraries for target \"TestUnknownLibWithoutSources\" + which is not built by this project. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects.cmake b/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects.cmake new file mode 100644 index 0000000..8e014c2 --- /dev/null +++ b/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestUnknownLibWithoutSources UNKNOWN IMPORTED) +target_link_libraries(TestUnknownLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/UNKNOWNwithOnlyObjectSources-result.txt b/Tests/RunCMake/add_library/UNKNOWNwithOnlyObjectSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_library/UNKNOWNwithOnlyObjectSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_library/UNKNOWNwithOnlyObjectSources-stderr.txt b/Tests/RunCMake/add_library/UNKNOWNwithOnlyObjectSources-stderr.txt new file mode 100644 index 0000000..e332281 --- /dev/null +++ b/Tests/RunCMake/add_library/UNKNOWNwithOnlyObjectSources-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at UNKNOWNwithOnlyObjectSources.cmake:[0-9]+ \(target_sources\): + target_sources called with non-compilable target type +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_library/UNKNOWNwithOnlyObjectSources.cmake b/Tests/RunCMake/add_library/UNKNOWNwithOnlyObjectSources.cmake new file mode 100644 index 0000000..604e339 --- /dev/null +++ b/Tests/RunCMake/add_library/UNKNOWNwithOnlyObjectSources.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestUnknownLibWithoutSources UNKNOWN IMPORTED) +target_sources(TestUnknownLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/test.cpp b/Tests/RunCMake/add_library/test.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/add_library/test.cpp |