summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/Ninja/CustomCommandExplicitDepends.cmake18
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake12
2 files changed, 30 insertions, 0 deletions
diff --git a/Tests/RunCMake/Ninja/CustomCommandExplicitDepends.cmake b/Tests/RunCMake/Ninja/CustomCommandExplicitDepends.cmake
new file mode 100644
index 0000000..e0c2434
--- /dev/null
+++ b/Tests/RunCMake/Ninja/CustomCommandExplicitDepends.cmake
@@ -0,0 +1,18 @@
+cmake_minimum_required(VERSION 3.26)
+project(CustomCommandExplicitDepends C)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/command.h"
+ COMMAND "${CMAKE_COMMAND}" -E touch
+ "${CMAKE_CURRENT_BINARY_DIR}/command.h"
+ COMMENT "Creating command.h"
+ DEPENDS_EXPLICIT_ONLY
+)
+
+add_library(dep STATIC dep.c)
+
+add_library(top STATIC
+ top.c
+ "${CMAKE_CURRENT_BINARY_DIR}/command.h"
+)
+target_link_libraries(top PRIVATE dep)
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 9214e90..17ad035 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -190,6 +190,18 @@ function (run_LooseObjectDepends)
endfunction ()
run_LooseObjectDepends()
+function (run_CustomCommandExplictDepends)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandExplicitDepends-build)
+ run_cmake(CustomCommandExplicitDepends)
+ run_ninja("${RunCMake_TEST_BINARY_DIR}" "command.h")
+ if (EXISTS "${RunCMake_TEST_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}dep${CMAKE_STATIC_LIBRARY_SUFFIX}")
+ message(FATAL_ERROR
+ "The `dep` library was created when requesting an custom command to be "
+ "generated; this should no longer be necessary when passing DEPENDS_EXPLICIT_ONLY keyword.")
+ endif ()
+endfunction ()
+run_CustomCommandExplictDepends()
+
function (run_AssumedSources)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AssumedSources-build)
run_cmake(AssumedSources)