summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/add_library
diff options
context:
space:
mode:
authorDeniz Bahadir <dbahadir@benocs.com>2017-10-19 12:31:10 (GMT)
committerBrad King <brad.king@kitware.com>2017-10-24 12:14:47 (GMT)
commit4e7f67383f297d708efbb6640c9bee188a127d4e (patch)
tree4aba6cacdf3974f6bfbb4cb5908a37011a5ed33c /Tests/RunCMake/add_library
parent6e4e7c6547fb4d379d564340d015af20e4a4e892 (diff)
downloadCMake-4e7f67383f297d708efbb6640c9bee188a127d4e.zip
CMake-4e7f67383f297d708efbb6640c9bee188a127d4e.tar.gz
CMake-4e7f67383f297d708efbb6640c9bee188a127d4e.tar.bz2
Defer check for sources within a target until generation.
The `add_library` and `add_executable` commands can now be called with no source-files and won't generate a warning or error message, as long as source-files will be added later via the `target_sources` command. If during the generation step still no sources are associated with targets created by such calls a useful error message will be generated and generation fails. Targets of type `INTERFACE_LIBRARY`, `UTILITY` or `GLOBAL_TARGET` are excluded from this check because we do not need sources for these target types during generation. Fixes: #16872
Diffstat (limited to 'Tests/RunCMake/add_library')
-rw-r--r--Tests/RunCMake/add_library/MODULEwithNoSources-stderr.txt7
-rw-r--r--Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-stderr.txt7
-rw-r--r--Tests/RunCMake/add_library/MODULEwithOnlyObjectSources-stderr.txt1
-rw-r--r--Tests/RunCMake/add_library/OBJECTwithNoSources-result.txt2
-rw-r--r--Tests/RunCMake/add_library/OBJECTwithNoSources-stderr.txt6
-rw-r--r--Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt3
-rw-r--r--Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt3
-rw-r--r--Tests/RunCMake/add_library/SHAREDwithNoSources-stderr.txt7
-rw-r--r--Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-stderr.txt7
-rw-r--r--Tests/RunCMake/add_library/SHAREDwithOnlyObjectSources-stderr.txt1
-rw-r--r--Tests/RunCMake/add_library/STATICwithNoSources-stderr.txt7
-rw-r--r--Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-stderr.txt7
-rw-r--r--Tests/RunCMake/add_library/STATICwithOnlyObjectSources-stderr.txt1
13 files changed, 31 insertions, 28 deletions
diff --git a/Tests/RunCMake/add_library/MODULEwithNoSources-stderr.txt b/Tests/RunCMake/add_library/MODULEwithNoSources-stderr.txt
index 5cf0b1e..41da381 100644
--- a/Tests/RunCMake/add_library/MODULEwithNoSources-stderr.txt
+++ b/Tests/RunCMake/add_library/MODULEwithNoSources-stderr.txt
@@ -1,3 +1,4 @@
-^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\".)?$
+^CMake Error at MODULEwithNoSources.cmake:[0-9]+ \(add_library\):
+ No SOURCES given to target: TestModuleLibWithoutSources
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-stderr.txt
index 951594a..67dd87c 100644
--- a/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-stderr.txt
+++ b/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-stderr.txt
@@ -1,3 +1,4 @@
-^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\".)*$
+^CMake Error at MODULEwithNoSourcesButLinkObjects.cmake:[0-9]+ \(add_library\):
+ No SOURCES given to target: TestModuleLibWithoutSources
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/add_library/MODULEwithOnlyObjectSources-stderr.txt b/Tests/RunCMake/add_library/MODULEwithOnlyObjectSources-stderr.txt
deleted file mode 100644
index de83755..0000000
--- a/Tests/RunCMake/add_library/MODULEwithOnlyObjectSources-stderr.txt
+++ /dev/null
@@ -1 +0,0 @@
-^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/OBJECTwithNoSources-result.txt b/Tests/RunCMake/add_library/OBJECTwithNoSources-result.txt
index 9c558e3..d00491f 100644
--- a/Tests/RunCMake/add_library/OBJECTwithNoSources-result.txt
+++ b/Tests/RunCMake/add_library/OBJECTwithNoSources-result.txt
@@ -1 +1 @@
-.
+1
diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSources-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithNoSources-stderr.txt
index 099ec4f..20d3a8a 100644
--- a/Tests/RunCMake/add_library/OBJECTwithNoSources-stderr.txt
+++ b/Tests/RunCMake/add_library/OBJECTwithNoSources-stderr.txt
@@ -1,2 +1,4 @@
-^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)*$
+^CMake Error at OBJECTwithNoSources.cmake:[0-9]+ \(add_library\):
+ No SOURCES given to target: TestObjectLibWithoutSources
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt
index 8f20096..cd6f1e0 100644
--- a/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt
+++ b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt
@@ -1,5 +1,4 @@
-^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\):
+^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\):
diff --git a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt
index f9cbf6b..77a72f1 100644
--- a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt
+++ b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt
@@ -1,5 +1,4 @@
-^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\):
+^CMake Error at OBJECTwithOnlyObjectSources.cmake:[0-9]+ \(add_library\):
OBJECT library \"TestObjectLibWithoutSources\" contains:
[^
diff --git a/Tests/RunCMake/add_library/SHAREDwithNoSources-stderr.txt b/Tests/RunCMake/add_library/SHAREDwithNoSources-stderr.txt
index 228d1cc..5cedd62 100644
--- a/Tests/RunCMake/add_library/SHAREDwithNoSources-stderr.txt
+++ b/Tests/RunCMake/add_library/SHAREDwithNoSources-stderr.txt
@@ -1,3 +1,4 @@
-^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\".)*$
+^CMake Error at SHAREDwithNoSources.cmake:[0-9]+ \(add_library\):
+ No SOURCES given to target: TestSharedLibWithoutSources
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-stderr.txt
index 228d1cc..d621e76 100644
--- a/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-stderr.txt
+++ b/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-stderr.txt
@@ -1,3 +1,4 @@
-^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\".)*$
+^CMake Error at SHAREDwithNoSourcesButLinkObjects.cmake:[0-9]+ \(add_library\):
+ No SOURCES given to target: TestSharedLibWithoutSources
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/add_library/SHAREDwithOnlyObjectSources-stderr.txt b/Tests/RunCMake/add_library/SHAREDwithOnlyObjectSources-stderr.txt
deleted file mode 100644
index ec350cd..0000000
--- a/Tests/RunCMake/add_library/SHAREDwithOnlyObjectSources-stderr.txt
+++ /dev/null
@@ -1 +0,0 @@
-^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/STATICwithNoSources-stderr.txt b/Tests/RunCMake/add_library/STATICwithNoSources-stderr.txt
index 830eb22..10b2112 100644
--- a/Tests/RunCMake/add_library/STATICwithNoSources-stderr.txt
+++ b/Tests/RunCMake/add_library/STATICwithNoSources-stderr.txt
@@ -1,3 +1,4 @@
-^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)+$
+^CMake Error at STATICwithNoSources.cmake:[0-9]+ \(add_library\):
+ No SOURCES given to target: TestStaticLibWithoutSources
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-stderr.txt
index 830eb22..33c23b2 100644
--- a/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-stderr.txt
+++ b/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-stderr.txt
@@ -1,3 +1,4 @@
-^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)+$
+^CMake Error at STATICwithNoSourcesButLinkObjects.cmake:[0-9]+ \(add_library\):
+ No SOURCES given to target: TestStaticLibWithoutSources
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/add_library/STATICwithOnlyObjectSources-stderr.txt b/Tests/RunCMake/add_library/STATICwithOnlyObjectSources-stderr.txt
deleted file mode 100644
index 5cd10d4..0000000
--- a/Tests/RunCMake/add_library/STATICwithOnlyObjectSources-stderr.txt
+++ /dev/null
@@ -1 +0,0 @@
-^You have called ADD_LIBRARY for library TestStaticLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file$