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

Simon Schäfer Simon.Schaefer at sevenload.com
Thu Jan 29 13:04:48 EST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tyler wrote:
> 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?
Yes I meant highest level.

> 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).

Right now I am using the subdir logic (from the past where there were
more c projects and the py project was a c project). So no problem with
that but I never successfully used the command by myself. I tried it
right now with the following two possibilities:

in the highest level CMakeLists.txt:
add_subdirectroy(pyProject)
add_subdirectroy(cProject)

first try:

ADD_CUSTOM_TARGET(pyCustom COMMAND ${PYTHON_EXECUTABLE} -O -c "import
compileall; compileall.compile_dir('./pyProject/', maxlevels=0, force=1);"
	DEPENDS cProject/cbin
)

results into a clean build but no pyc files and no /usr/bin/python in
the Makefiles

second try:
ADD_CUSTOM_TARGET(pyCustom ALL COMMAND ${PYTHON_EXECUTABLE} -O -c
"import compileall; compileall.compile_dir('./pyProject/', maxlevels=0,
force=1);"
	DEPENDS cProject/cbin
)

gives me the following errors (make VERBOSE=1)

/usr/bin/python -O -c import\ compileall;\
compileall.compile_dir('./pyProject/',\ maxlevels=0,\ force=1);
/bin/sh: -c: line 0: syntax error near unexpected token
`'./pyProject/',\ maxlevels=0,\ force=1'
/bin/sh: -c: line 0: `/usr/bin/python -O -c import\ compileall;\
compileall.compile_dir('./pyProject/',\ maxlevels=0,\ force=1);'

> hth,
> tyler

Simon

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmB78AACgkQCT+234kh3agEsgCfYgJYjEhag8K9npnlRKvXHR7C
TLoAn26+cl7av98z6NRc3smjRZdVuApC
=oHNo
-----END PGP SIGNATURE-----


More information about the CMake mailing list