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
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to