CMake keeps rebuilding custom command dependencies of a custom target
A reproducing project is attached:
For easier reference, the contents of the tarball are:
CMakeLists.txt:
cmake_minimum_required (VERSION 3.0)
project(modules)
add_custom_command(
OUTPUT out.txt
COMMAND cp in.txt out.txt
MAIN_DEPENDENCY in.txt
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)
add_custom_target(buggy ALL DEPENDS out.txt)
in.txt:
test
On Linux, when building the attached project with cmake, it keeps rebuilding out.txt
even though in.txt
never changes:
mkdir build
cd build
cmake ..
make
make # rebuilds out.txt but it shouldn't