cmake and custom build targets

Brad King brad.king at kitware.com
Mon Mar 13 22:23:55 CET 2006


Alexander Dymo wrote:
> I'm using add_custom_target to create some files before building ThreadWeaver
> library (http://websvn.kde.org/trunk/kdenonbeta/threadweaver/Weaver).
> The problem is I want to generate Job_moc.cpp only once but 
> it is recreated each time i run make. Can anybody please tell me how can I
> avoid that?

Look at the first sentence of the documentation of add_custom_target:

"Add a target with no output so it will always be built."

and later

"Adds a target with the given name that executes the given commands 
every time the target is built."

See this FAQ entry for how to generate a source file:

http://www.cmake.org/Wiki/index.php/CMake_FAQ#How_can_I_generate_a_source_file_during_the_build.3F

-Brad


More information about the Kde-buildsystem mailing list