[CMake] I need help with compiling python scripts more than once
Tyler Roscoe
tyler at cryptio.net
Thu Jan 29 11:25:25 EST 2009
On Thu, Jan 29, 2009 at 03:27:44PM +0100, Simon Schäfer wrote:
> I want to automate the build of my python scripts which work together
> with my C project, and on a later stage pack all together with CPack.
>
> My problem for now is to automatically build my python code with cmake.
> I am able to build it on the initial cmake build but on a following make
> it will not recompile. Best would be if I can declare some files (the
> .py files) on which the recompile will be redone.
>
> My current CMakeLists.txt:
>
> PROJECT ("python scripts")
> CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
> FIND_PACKAGE(PythonInterp 2.4)
> EXECUTE_PROCESS(
> COMMAND ${PYTHON_EXECUTABLE} -O -c "import compileall;
> compileall.compile_dir('.', maxlevels=0, force=1);"
> OUTPUT_VARIABLE pythonBuild
> )
I don't know if I really understand your problem but I would consider
using add_custom_command and add_custom_target to make this part of your
build behave like the other parts of your build. That way, you get a
target that runs when your .pyc are out of date and you can have your C
code depend on your python code.
tyler
More information about the CMake
mailing list