[CMake] how to automatically make object from generated source?

Mathieu Malaterre mathieu.malaterre at gmail.com
Tue Jun 12 09:04:26 EDT 2007


On 6/12/07, Jens.M.Hoffmann at bahn.de <Jens.M.Hoffmann at bahn.de> wrote:
>
>
>
>
> Hello,
>
> thanks for the replies to my previous question. Here comes the next one.
>
> I have got a couple of C and C++ sources with embedded SQL. These are
> transformed into
> real C and C++ sources with a preprocessor (Oracle proc). The resulting
> sources should be
> compiled with gcc with my ADD_DEFINITIONS and INCLUDE_DIRECTORIES settings.
> The resulting object than must be linked with a custom command called
> buildserver.
>
> So what I'm trying now is
>
> SET_SOURCE_FILES_PROPERTIES( ${src_dir}/admin/clean.cpp PROPERTIES
> GENERATED true )
>
> ADD_CUSTOM_COMMAND( OUTPUT ${src_dir}/admin/clean.cpp
>                 COMMAND proc MODE=ANSI code=cpp
>                 iname=${src_dir}/admin/clean.ec
>                 oname=${src_dir}/admin/clean.cpp
>                 DEPENDS ${src_dir}/admin/clean.ec )
>
> ADD_CUSTOM_COMMAND( OUTPUT ${src_dir}/admin/clean
>                 COMMAND buildserver -o ${src_dir}/admin/clean
>                       -f ${src_dir}/admin/clean.o
>                   DEPENDS ${src_dir}/admin/clean.o )
>
> ADD_CUSTOM_TARGET( dummy ALL DEPENDS ${src_dir}/admin/clean )

I suggested dummy, but you should really use another name. Take for
instance the name of the executable, it will add a nicer target (more
representativ) in your makefile. As a

> What I'm now getting is the following error message:
>
> make[2]: *** No rule to make target `[...]/admin/clean.o', needed by
> `[...]/admin/clean'.
> Stop.
>
> I thought about adding a custom command for this step (.cpp -> .o) but that
> seems not so nice.
> Is there a better way or am i missing something?
>
> Regards
> Jens-Michael
>
>
>
> ---------
>
> Diese E-Mail könnte  vertrauliche und/oder rechtlich geschützte
> Informationen enthalten. Wenn Sie nicht der richtige Adressat sind oder
> diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den
> Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die
> unbefugte Weitergabe dieser Mail sind nicht gestattet.
>
> This e-mail may contain confidential and/or privileged information. If you
> are not the intended recipient (or have received this e-mail in error)
> please notify the sender immediately and destroy this e-mail. Any
> unauthorized copying, disclosure or distribution of the material in this
> e-mail is strictly forbidden.
>
> ----------
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>


-- 
Mathieu


More information about the CMake mailing list