mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 21:31:08 -06:00
Add option `DEPENDS_EXPLICIT_ONLY` to `add_custom_command` to indicate that implicit dependencies coming from users of the output are not needed, and only consider dependencies explicitly specified in the custom command. Fixes: #17097
19 lines
439 B
CMake
19 lines
439 B
CMake
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)
|