[CMake] problem with add_custom_command / add_custom_target in different directories
Brad King
brad.king at kitware.com
Thu Feb 26 08:57:14 EST 2009
Philip Lowman wrote:
> Brad King wrote:
>> I suggest making the extraction
>> rule generate a stamp file with "cmake -E touch ...".
>
> Thanks for pointing out those two problems. Not too worried about
> either of them at the moment given what this is intended for. Another
> thing did concern me which was the removal of the untar'd directory on a
> "make clean". Is there any easy way to disable this?
CMake will always clean the outputs of custom commands. If you use a
stamp file then only the stamp will get cleaned. Then make your untar
rule smart enough to not untar again and instead recreate the stamp. The
rule can point at a cmake script with "cmake -P ...".
> The ultimate goal here would be
> 1.) User types "make"
> 1a.) CMake untars several source tarballs each in different directories
> 1b.) CMake patches several source trees in different directories
> 1c.) CMake automatically detects those directories now exist, recurses
> into them with add_subdirectory() and builds stuff
> 2.) User types "make clean" and only compiled code gets cleaned, not
> generated directories.
Take a look at the AddExternalProject.cmake module Dave Cole recently added
in CVS HEAD. It is designed specifically for building external projects
from several possible sources.
-Brad
More information about the CMake
mailing list