[CMake] Pure Python project
    Brad King 
    brad.king at kitware.com
       
    Wed May 21 10:50:03 EDT 2008
    
    
  
Emmanuel Blot wrote:
> Hi,
> 
> I'm using CMake (2.6) to build several C and C++ projects.
> I'd like to add another project which would be a pure Python project:
> 
> CMake would simply have to invoke Python script (which in turn generates
> an output file based on two input files).
> What would be the rules to do so ?
> 
> I've tried ADD_CUSTOM_COMMAND and ADD_CUSTOM_TARGET with no luck:
> CMake does create the Makefile files, but running "make" simply does
> nothing (no error, simply does nothing)
http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_generate_a_source_file_during_the_build.3F
The command
  add_custom_command(OUTPUT myout.txt COMMAND ...)
tells CMake how to generate myout.txt.  Then you have to tell CMake you
want to generate it by depending on the output from a target.  The
target can either be an executable you're already building:
  add_executable(myexe myexe.c myout.txt)
or a custom target:
  add_custom_target(MyDriverTarget ALL DEPENDS myout.txt)
The "ALL" option makes the custom target build by default.
-Brad
    
    
More information about the CMake
mailing list