add_custom_command fails when OUTPUT is generated into a subdirectory
Find attached a minimal example, where I am generating sources for a library my-lib
using add_custom_command
, an executable my-app
depends on:
As long as I generate the files directly into my-lib
's CMAKE_CURRENT_BINARY_DIR
everything works fine. If I want to generate the files into a subdirectory e.g. generate
, either configurating or building or both does not work anymore.
I created three different "versions" to demonstrate. You can try each setting the VERSION
value in my-lib\CMakeLists.txt
line 16.
The documentation states:
If an output name is a relative path it will be interpreted relative to the build tree directory corresponding to the current source directory.
What am I missing?