add_custom_target runs twice
cmake_minimum_required(VERSION 3.13)
project(ARGH)
add_custom_target(argh
COMMENT "ARGH"
COMMAND echo "argh!"
BYPRODUCTS ${CMAKE_CURRENT_SOURCE_DIR}/argh
)
set_property(
DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/argh
)
$ cmake --version
cmake version 3.24.2
$ touch argh
$ cmake -B build -S . -G Ninja
...
$ cmake --build build --target argh
[1/2] ARGH
argh!
[1/1] ARGH
argh!
why does it run twice?
- if i comment out the BYPRODUCTS line, it runs once
- if i comment out the CMAKE_CONFIGURE_DEPENDS, it runs once
but nothing is touching that file.
Edited by Spongman