[Cmake] DSP dependencies

Bill Hoffman bill.hoffman at kitware.com
Thu Dec 19 14:13:43 EST 2002


At 07:37 AM 12/17/2002 -0500, Ansel Freniere wrote:
>Hi, I'm a new user to CMake.  We are evaluating CMake for cross-platform builds of our OSLO lens design product.  I have successfully generated some makefiles for our project, but the dependencies do not quite work under Developer Studio, causing excessive building.
>There are two dependency problems.
>
>First problem:
>We have a few custom-built executables which, when run, build some files (binary data) and c source and header files during the build.  I can not quite see how to encode these dependencies into CMake so that they work properly and only build when necessary.  I do see that it would seem to require something using ADD_CUSTOM_TARGET and/or ADD_CUSTOM_COMMAND, but I can't quite tell how to use these commands.  
>For example, in a traditional unix makefile I would have:
>
>app: data.bin defs.h app.c app.h
>        gcc app.c -o app
>
>defs.h: data.txt compile
>        compile data.txt
>
>data.bin: data.txt compile
>        compile data.txt
>
>compile: compile.c
>        gcc -o compile compile.c
>
>This generates two output files, one of which is a generated C header file.  I see how to use SOURCE_FILES with the GENERATED keyword to mark c source files that are generated at make time.  However, how do I use a custom command to tell CMake how to see the dependencies that this command has, and how to build them?  This is all complicated by the fact that the compile command actually generates two output files.
Here is an example from VTK that might help.
The source file tif_fax3sm.c is generated by the program
mkg3states which is built by the project.


    SET_SOURCE_FILES_PROPERTIES(tif_fax3sm.c GENERATED)
    ADD_EXECUTABLE(mkg3states mkg3states.c)    
    ADD_CUSTOM_COMMAND(
      SOURCE ${EXECUTABLE_OUTPUT_PATH}/mkg3states       # add a depend to the exe
      COMMAND ${EXECUTABLE_OUTPUT_PATH}/mkg3states      # command to run
      ARGS -c const ${VTKTIFF_BINARY_DIR}/tif_fax3sm.c  # arguments for command
      TARGET mkg3states                                 # depends on target mkg3states
      OUTPUTS ${VTKTIFF_BINARY_DIR}/tif_fax3sm.c)       # creates tif_fax3sm.c

>Second problem:
>When I build my executable, I need some libraries that are built within the same workspace in other projects.  But CMake does not pass on this inter-project dependency information to the developer studio workspace (.dsw), and so there is no guarantee that the lib will get built before the executable.  How can I get cmake to encode this information into the dsw?

I think the INCLUDE_EXTERNAL_MSPROJECT command can be used for this.







More information about the CMake mailing list