[CMake] I need help with compiling python scripts more than once

Tyler tyler at cryptio.net
Thu Jan 29 12:36:23 EST 2009


On Thu, Jan 29, 2009 at 05:58:11PM +0100, Simon Schäfer wrote:
> well i have two projet which should both be build with cmake for example:
> 
> ./CMakeLists.txt
> ./pyProject/CMakeLists.txt
> ./cProject/CMakeLists.txt
> 
> now I want to compile all together when I am at the lowest level. I

You mean the highest level? Maybe you visualize trees upside-down from
how I do it, but you're asking about integrating both pyProject and
cProject from the directory that houses both of those directories,
right?

> don't want to deliver the source code to any of the programs therefore I
> do not send the python code out to the customer. The python code itself
> is not depending on the c code because its just a tool that communicates
> with the cProject.
> I tried the add_custom_command approach but ended up with the problem
> that I have no real build target and that the python command is not in
> the makefile so it would never rebuild the pyc anyway.
> 
> Well, if I would bind it to the cProject how do i let them depend on the
> pyc files?

Investigate add_subdirectory. From the top level, you do
add_subdirectory(pyProject) and add_subdirectory(cProject). Then you
have access to the targets defined in each, and your C targets can
depend on your python targets (or whatever).

hth,
tyler


More information about the CMake mailing list