summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLib/run_compile_commands.cxx9
-rw-r--r--Tests/RunCMake/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/add_executable/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/add_executable/NoSources-result.txt1
-rw-r--r--Tests/RunCMake/add_executable/NoSources-stderr.txt4
-rw-r--r--Tests/RunCMake/add_executable/NoSources.cmake1
-rw-r--r--Tests/RunCMake/add_executable/NoSourcesButLinkObjects-result.txt1
-rw-r--r--Tests/RunCMake/add_executable/NoSourcesButLinkObjects-stderr.txt11
-rw-r--r--Tests/RunCMake/add_executable/NoSourcesButLinkObjects.cmake5
-rw-r--r--Tests/RunCMake/add_executable/OnlyObjectSources-result.txt1
-rw-r--r--Tests/RunCMake/add_executable/OnlyObjectSources-stderr.txt11
-rw-r--r--Tests/RunCMake/add_executable/OnlyObjectSources.cmake5
-rw-r--r--Tests/RunCMake/add_executable/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/add_executable/test.cpp0
-rw-r--r--Tests/RunCMake/add_library/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/add_library/INTERFACEwithNoSources.cmake1
-rw-r--r--Tests/RunCMake/add_library/INTERFACEwithNoSourcesButLinkObjects.cmake5
-rw-r--r--Tests/RunCMake/add_library/INTERFACEwithOnlyObjectSources.cmake5
-rw-r--r--Tests/RunCMake/add_library/MODULEwithNoSources-result.txt1
-rw-r--r--Tests/RunCMake/add_library/MODULEwithNoSources-stderr.txt3
-rw-r--r--Tests/RunCMake/add_library/MODULEwithNoSources.cmake1
-rw-r--r--Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-result.txt1
-rw-r--r--Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-stderr.txt3
-rw-r--r--Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects.cmake5
-rw-r--r--Tests/RunCMake/add_library/MODULEwithOnlyObjectSources-stderr.txt1
-rw-r--r--Tests/RunCMake/add_library/MODULEwithOnlyObjectSources.cmake5
-rw-r--r--Tests/RunCMake/add_library/OBJECTwithNoSources-result.txt1
-rw-r--r--Tests/RunCMake/add_library/OBJECTwithNoSources-stderr.txt2
-rw-r--r--Tests/RunCMake/add_library/OBJECTwithNoSources.cmake1
-rw-r--r--Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-result.txt1
-rw-r--r--Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt6
-rw-r--r--Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects.cmake5
-rw-r--r--Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-result.txt1
-rw-r--r--Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt17
-rw-r--r--Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources.cmake5
-rw-r--r--Tests/RunCMake/add_library/RunCMakeTest.cmake24
-rw-r--r--Tests/RunCMake/add_library/SHAREDwithNoSources-result.txt1
-rw-r--r--Tests/RunCMake/add_library/SHAREDwithNoSources-stderr.txt3
-rw-r--r--Tests/RunCMake/add_library/SHAREDwithNoSources.cmake1
-rw-r--r--Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-result.txt1
-rw-r--r--Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-stderr.txt3
-rw-r--r--Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects.cmake5
-rw-r--r--Tests/RunCMake/add_library/SHAREDwithOnlyObjectSources-stderr.txt1
-rw-r--r--Tests/RunCMake/add_library/SHAREDwithOnlyObjectSources.cmake5
-rw-r--r--Tests/RunCMake/add_library/STATICwithNoSources-result.txt1
-rw-r--r--Tests/RunCMake/add_library/STATICwithNoSources-stderr.txt3
-rw-r--r--Tests/RunCMake/add_library/STATICwithNoSources.cmake1
-rw-r--r--Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-result.txt1
-rw-r--r--Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-stderr.txt3
-rw-r--r--Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects.cmake5
-rw-r--r--Tests/RunCMake/add_library/STATICwithOnlyObjectSources-stderr.txt1
-rw-r--r--Tests/RunCMake/add_library/STATICwithOnlyObjectSources.cmake5
-rw-r--r--Tests/RunCMake/add_library/UNKNOWNwithNoSources.cmake1
-rw-r--r--Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-result.txt1
-rw-r--r--Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-stderr.txt5
-rw-r--r--Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects.cmake5
-rw-r--r--Tests/RunCMake/add_library/UNKNOWNwithOnlyObjectSources-result.txt1
-rw-r--r--Tests/RunCMake/add_library/UNKNOWNwithOnlyObjectSources-stderr.txt4
-rw-r--r--Tests/RunCMake/add_library/UNKNOWNwithOnlyObjectSources.cmake5
-rw-r--r--Tests/RunCMake/add_library/test.cpp0
60 files changed, 212 insertions, 6 deletions
diff --git a/Tests/CMakeLib/run_compile_commands.cxx b/Tests/CMakeLib/run_compile_commands.cxx
index 0d692ca..b49803b 100644
--- a/Tests/CMakeLib/run_compile_commands.cxx
+++ b/Tests/CMakeLib/run_compile_commands.cxx
@@ -144,14 +144,11 @@ int main()
cmsys::ifstream file("compile_commands.json");
CompileCommandParser parser(file);
parser.Parse();
- for (CompileCommandParser::TranslationUnitsType::const_iterator
- it = parser.GetTranslationUnits().begin(),
- end = parser.GetTranslationUnits().end();
- it != end; ++it) {
+ for (auto const& tu : parser.GetTranslationUnits()) {
std::vector<std::string> command;
- cmSystemTools::ParseUnixCommandLine(it->at("command").c_str(), command);
+ cmSystemTools::ParseUnixCommandLine(tu.at("command").c_str(), command);
if (!cmSystemTools::RunSingleCommand(command, nullptr, nullptr, nullptr,
- it->at("directory").c_str())) {
+ tu.at("directory").c_str())) {
std::cout << "ERROR: Failed to run command \"" << command[0] << "\""
<< std::endl;
exit(1);
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