add_custom_target and add_custom_command

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

add_custom_target and add_custom_command

=?utf-8?q?M=C3=A1t=C3=A9_Ferenc_Nagy-Egri_via_CMake_=3Ccmake=40cmake?=

Hi!

 

Apologies for the noobish question, but even a seasoned CMake user can get lost from time to time.

 

I want to demonstrate the feasability of automating an article creation proces with CMake. Ultimately I want to issue commands as such on the CLI:

 

make app

make data

make plot

make article

 

These commands would:

 

compile a C/C++ application (no problem)

invoke that app with some args (provided by CMake) to create a data file (only if the app or the args have changed)

invoke a gnuplot script on the data file to create a plot (only if the the data file or the plotting script have changed)

invoke latex to create a document that references the plot (only if either the latex file or the plot changed)

 

Because any of the steps may take fairly lone, I would like each pass to do something only if any of the preceding steps are out of date. I sort of got lost in the custom_target and custom_command functions and how and when to use them to setup a chain of custom tool invocation that have well defined input and output files.

 

Could someone show a real simple demo?

 

Help is much appreciated.

 

Cheers,

Máté


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Loading...