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/add_executable | |
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/add_executable')
12 files changed, 48 insertions, 0 deletions
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 |