[CMake] Generate *.cpp/*.hpp with add_custom_command, reference these in add_library in another subdirectory/CMakeLists?
Martin Zenzes
martin.zenzes at dfki.de
Mon Jan 13 03:55:37 EST 2014
On 01/10/2014 11:43 AM, Nils Gladitz wrote:
> 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
Thanks. This solved my Problem, indeed!
One little quick follow-on-question. After doing:
set(GENERATED_CPP /path/to/not/yet/created/cpp/file.cpp)
this does not work as expected:
set_property(SOURCE ${GENERATED_CPP} PROPERTY GENERATED)
while this will works as expected:
set_source_files_properties(${GENERATED_CPP} PROPERTIES GENERATED)
bug?
--
M.Sc. Martin Zenzes
Space Robotics
Hauptgeschäftsstelle Standort Bremen:
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany
Phone: +49 (0) 421 178 45 - 6658
Fax: +49 (0) 421 178 45 - 4150
E-Mail: martin.zenzes at dfki.de
Weitere Informationen: http://www.dfki.de/robotik
-----------------------------------------------------------------------
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.: DE 148646973
Steuernummer: 19/673/0060/3
-----------------------------------------------------------------------
More information about the CMake
mailing list