diff options
author | Deniz Bahadir <dbahadir@benocs.com> | 2017-10-19 12:31:10 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-10-24 12:14:47 (GMT) |
commit | 4e7f67383f297d708efbb6640c9bee188a127d4e (patch) | |
tree | 4aba6cacdf3974f6bfbb4cb5908a37011a5ed33c /Tests/RunCMake/add_executable | |
parent | 6e4e7c6547fb4d379d564340d015af20e4a4e892 (diff) | |
download | CMake-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_executable')
4 files changed, 2 insertions, 21 deletions
diff --git a/Tests/RunCMake/add_executable/NoSources-stderr.txt b/Tests/RunCMake/add_executable/NoSources-stderr.txt index 5985905..4fcfd49 100644 --- a/Tests/RunCMake/add_executable/NoSources-stderr.txt +++ b/Tests/RunCMake/add_executable/NoSources-stderr.txt @@ -1,4 +1,4 @@ ^CMake Error at NoSources.cmake:[0-9]+ \(add_executable\): - add_executable called with incorrect number of arguments + No SOURCES given to target: TestExeWithoutSources Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-stderr.txt index c8afadb..5561daa 100644 --- a/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-stderr.txt +++ b/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-stderr.txt @@ -1,11 +1,4 @@ ^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. + No SOURCES given to target: TestExeWithoutSources Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_executable/OnlyObjectSources-result.txt b/Tests/RunCMake/add_executable/OnlyObjectSources-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/add_executable/OnlyObjectSources-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/add_executable/OnlyObjectSources-stderr.txt b/Tests/RunCMake/add_executable/OnlyObjectSources-stderr.txt deleted file mode 100644 index ea72d5d..0000000 --- a/Tests/RunCMake/add_executable/OnlyObjectSources-stderr.txt +++ /dev/null @@ -1,11 +0,0 @@ -^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\)$ |