[CMake] Building generated c++ code with py++ and boost.python

Pecevski Dejan dejan at igi.tugraz.at
Wed Oct 11 06:21:35 EDT 2006


Filipe Sousa wrote:

>ADD_CUSTOM_COMMAND(
>  OUTPOUT ${CMAKE_CURRENT_BINARY_DIR}/A1.cpp
>${CMAKE_CURRENT_BINARY_DIR}/A1.h .. A2.cpp ...
>  COMMAND generate.py ${CMAKE_CURRENT_BINARY_DIR}/Abase.h
>  DEPENDS genereate.py ${CMAKE_CURRENT_BINARY_DIR}/Abase.h
>)
>You have to add the genareated file to ADD_LIBRARY() or ADD_EXECUTABLE()
>  
>
Hi Filipe,
Thanks for the reply.
I have setup a simple example based on your solution, but it doesn't 
seem to work. Files of the example are attached to the e-mail.
Basically in the example I am building a library libtest from these files:
a.cpp - source for the library
a.h - header file (it includes b.h)
copy.h - generated header file by simple copying a.h. This file is 
included in a.cpp.
b.h - file included in a.h

The CMakeLists.txt is as follows:
-------------------------------
ADD_CUSTOM_COMMAND( OUTPUT copy.h
                    COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/a.h 
${CMAKE_CURRENT_SOURCE_DIR}/copy.h
                    DEPENDS a.h
                    )

INCLUDE_DIRECTORIES( $CMAKE_CURRENT_SOURCE_DIR )

ADD_LIBRARY( test a.cpp copy.h )
------------------------------

The library builds ok, but the copy.h file is not really dependent of 
b.h, and it should be, because a.h includes it. So the question is, how 
to make
this kind of dependency work?

And the other problem is that I don't know what is the list of generated 
wrapper c++ files, until they are generated, and I need the list
to include it in a ADD_LIBRARY statement for the wrapper library.

Is there a way to accomplish this?

Thanks,
Dejan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.tar.gz
Type: application/x-gzip
Size: 478 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20061011/d7ed401a/example.tar.bin


More information about the CMake mailing list