From 4a3e79048b6afd7eb86f72b1365028e6233c92b0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 28 Feb 2023 17:49:12 -0500 Subject: Tests: Add RunCMake.target_sources case covering missing source --- Tests/RunCMake/target_sources/CMakeLists.txt | 2 +- Tests/RunCMake/target_sources/MissingSource-result.txt | 1 + Tests/RunCMake/target_sources/MissingSource-stderr.txt | 6 ++++++ Tests/RunCMake/target_sources/MissingSource.cmake | 3 +++ Tests/RunCMake/target_sources/RunCMakeTest.cmake | 1 + 5 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 Tests/RunCMake/target_sources/MissingSource-result.txt create mode 100644 Tests/RunCMake/target_sources/MissingSource-stderr.txt create mode 100644 Tests/RunCMake/target_sources/MissingSource.cmake diff --git a/Tests/RunCMake/target_sources/CMakeLists.txt b/Tests/RunCMake/target_sources/CMakeLists.txt index 727f93a..296fdda 100644 --- a/Tests/RunCMake/target_sources/CMakeLists.txt +++ b/Tests/RunCMake/target_sources/CMakeLists.txt @@ -1,3 +1,3 @@ cmake_minimum_required(VERSION 3.11) project(${RunCMake_TEST} LANGUAGES NONE) -include(${RunCMake_TEST}.cmake) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/target_sources/MissingSource-result.txt b/Tests/RunCMake/target_sources/MissingSource-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/MissingSource-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/MissingSource-stderr.txt b/Tests/RunCMake/target_sources/MissingSource-stderr.txt new file mode 100644 index 0000000..b082603 --- /dev/null +++ b/Tests/RunCMake/target_sources/MissingSource-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at MissingSource\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + + missing\.txt +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_sources/MissingSource.cmake b/Tests/RunCMake/target_sources/MissingSource.cmake new file mode 100644 index 0000000..2bb71e4 --- /dev/null +++ b/Tests/RunCMake/target_sources/MissingSource.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0115 NEW) +add_custom_target(foo) +target_sources(foo PRIVATE missing.txt) diff --git a/Tests/RunCMake/target_sources/RunCMakeTest.cmake b/Tests/RunCMake/target_sources/RunCMakeTest.cmake index c1314f7..90915cd 100644 --- a/Tests/RunCMake/target_sources/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_sources/RunCMakeTest.cmake @@ -9,6 +9,7 @@ run_cmake(OriginDebug) run_cmake(CMP0026-LOCATION) run_cmake(CMP0076-OLD) run_cmake(CMP0076-WARN) +run_cmake(MissingSource) run_cmake(RelativePathInInterface) run_cmake(RelativePathInSubdirGenEx) run_cmake(RelativePathInSubdirInterface) -- cgit v0.12