[CMake] add_dependencies being ignored for add_custom_command?
Martin Braun
martin.braun at ettus.com
Fri Oct 23 20:35:26 EDT 2015
Hey,
I'm at a loss here:
I have a command that's run with add_custom_command(). I need to run it
before compiling a library that I add with add_library(), because it
generates some header files.
This was my first try:
file1:
{{{
add_custom_command(
OUTPUT foo.hpp
COMMAND bar
)
}}}
file2:
{{{
add_library(baz ${sources})
add_dependencies(baz ${CMAKE_BINARY_DIR}/path/to/foo.hpp)
}}}
==> This didn't work. If I run make -j4, it will always try and compile
my ${sources} before it ran the command. Maybe I'm specifying targets
the wrong way?
Next try:
file1:
{{{
add_custom_command(TARGET baz
PRE_BUILD
OUTPUT foo.hpp
COMMAND bar
)
}}}
file2:
{{{
add_library(baz ${sources})
}}}
==> Same behaviour.
I'm using CMake 2.8.2.12. Really, I need something that works with CMake
2.8.0 because that's the minimum we guarantee our customers.
Any ideas? Thanks in advance!
Cheers,
Martin
More information about the CMake
mailing list