summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/Ninja/CustomCommandExplicitDepends.cmake
diff options
context:
space:
mode:
authorAbdelmaged Khalifa <abdelmaged.khalifa@gmail.com>2023-02-17 13:11:01 (GMT)
committerAbdelmaged Khalifa <abdelmaged.khalifa@gmail.com>2023-02-17 15:12:12 (GMT)
commitea2a05f402d2e1090d8d1e92e67c08ac1e5af66a (patch)
treec82a237ca6fd9e37891d49fe459d8ae898cbd3e8 /Tests/RunCMake/Ninja/CustomCommandExplicitDepends.cmake
parent51c79170720abc16981381c924e2c50b5ed45ecf (diff)
downloadCMake-ea2a05f402d2e1090d8d1e92e67c08ac1e5af66a.zip
CMake-ea2a05f402d2e1090d8d1e92e67c08ac1e5af66a.tar.gz
CMake-ea2a05f402d2e1090d8d1e92e67c08ac1e5af66a.tar.bz2
Add variable CMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY
Add CMake variable `CMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY` to enable option `DEPENDS_EXPLICIT_ONLY` on all uses of `add_custom_command`. Fixes: #17097
Diffstat (limited to 'Tests/RunCMake/Ninja/CustomCommandExplicitDepends.cmake')
-rw-r--r--Tests/RunCMake/Ninja/CustomCommandExplicitDepends.cmake30
1 files changed, 24 insertions, 6 deletions
diff --git a/Tests/RunCMake/Ninja/CustomCommandExplicitDepends.cmake b/Tests/RunCMake/Ninja/CustomCommandExplicitDepends.cmake
index e0c2434..fefd86a 100644
--- a/Tests/RunCMake/Ninja/CustomCommandExplicitDepends.cmake
+++ b/Tests/RunCMake/Ninja/CustomCommandExplicitDepends.cmake
@@ -2,17 +2,35 @@ cmake_minimum_required(VERSION 3.26)
project(CustomCommandExplicitDepends C)
add_custom_command(
- OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/command.h"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/command-option.h"
COMMAND "${CMAKE_COMMAND}" -E touch
- "${CMAKE_CURRENT_BINARY_DIR}/command.h"
- COMMENT "Creating command.h"
+ "${CMAKE_CURRENT_BINARY_DIR}/command-option.h"
+ COMMENT "Creating command-option.h"
DEPENDS_EXPLICIT_ONLY
)
-add_library(dep STATIC dep.c)
+set(CMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY ON)
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/command-variable-on.h"
+ COMMAND "${CMAKE_COMMAND}" -E touch
+ "${CMAKE_CURRENT_BINARY_DIR}/command-variable-on.h"
+ COMMENT "Creating command-variable-on.h"
+)
+
+set(CMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY OFF)
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/command-variable-off.h"
+ COMMAND "${CMAKE_COMMAND}" -E touch
+ "${CMAKE_CURRENT_BINARY_DIR}/command-variable-off.h"
+ COMMENT "Creating command-variable-off.h"
+)
+
+add_library(dep SHARED dep.c)
-add_library(top STATIC
+add_library(top SHARED
top.c
- "${CMAKE_CURRENT_BINARY_DIR}/command.h"
+ "${CMAKE_CURRENT_BINARY_DIR}/command-option.h"
+ "${CMAKE_CURRENT_BINARY_DIR}/command-variable-on.h"
+ "${CMAKE_CURRENT_BINARY_DIR}/command-variable-off.h"
)
target_link_libraries(top PRIVATE dep)