[CMake] Generate *.cpp/*.hpp with add_custom_command, reference these in add_library in another subdirectory/CMakeLists?
Nils Gladitz
nilsgladitz at gmail.com
Fri Jan 10 05:43:12 EST 2014
On 01/10/2014 11:21 AM, Martin Zenzes wrote:
>
> 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?
>
I think against the "Cannot find source file" problem it would help to
set the "GENERATED" source file property.
add_dependencies(mylibrary mycustomtarget) should make sure they are
build in the right order.
Nils
More information about the CMake
mailing list