Hi,
I'm generating a *.cpp/*.hpp pair of files using add_custom_command() +
add_custom_target(). These are then referenced in add_library() to be
compiled and linked into a library, together with some "static"
source-files. This works well as long as both parts (generating and
creating the library) are in the same CMakeLists. This is also stated in
the documentation [1]:
{{{
A target created in the same directory (CMakeLists.txt file) that
specifies any output of the custom command as a source file is given a
rule to generate the file using the command at build time.
}}}
My question: Is there a way to split the generating and compiling into
different subdirectories/CMakeLists, and specify the "rule to generate
the file" manually for the add_library() target?
The problem: At the time the add_library() is processed by cmake, the
referenced *.cpp/*.hpp files are not yet created, hence they are not
found ("Cannot find source file"). Adding the generate-target to ALL
does not help, as at the target is executed to create the file _after_
the add_library() call is processed.
Any hints?
Greetings and thanks for your efforts.
[1] http://cmake.org/cmake/help/v2.8.7/cmake.html#command:add_custom_command
--
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://www.cmake.org/mailman/listinfo/cmake