Files
CMake/Tests/RunCMake/Ninja/CustomCommandExplicitDepends.cmake
Abdelmaged Khalifa 082ccd7530 add_custom_command: Add DEPENDS_EXPLICIT_ONLY option for Ninja
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
2023-02-14 08:56:59 -05:00

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)