[CMake] Checking Disk space with Cmake
Eric Noulard
eric.noulard at gmail.com
Tue Aug 11 03:16:29 EDT 2009
2009/8/11 avner cohen <avcoh at yahoo.com>:
>
> Hi all,
>
> I'm trying to set a rule/command/somthing, that will be executed with every build (even if cmake files are not touched) to check for DiskSpace available before starting the build.
I think you currently have no mean to ensure that some
command/target/something will be run first, however you can
1) create a custom target
add_custom_target(CheckDisk <your_check_disk_command>
COMMENT "Check available disk space before build")
2) then add this target as a dependency for ALL other target you add
ADD_LIBRARY, ADD_EXECUTABLE etc...
add_executable(blah blah.c)
add_dependencies(blah CheckDisk)
> In case of error, I'd like the build to exit ofcourse.
If the specified <your_check_disk_command> fails the build should stop.
Example project working with a pseudo checkdisk.sh, bash script attached.
Note that add_custom_target may use the ALL option which would force the target
to be run for EVERY build, but I don't know WHEN the target will be launched.
May be CMake developer can tell us when a ALLed add_custom_target will
be run? May be it will be run first if it is the first specified target in the
top level CMakeLists.txt??
--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CheckDiskProj.zip
Type: application/zip
Size: 994 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090811/d58f7075/attachment.zip>
More information about the CMake
mailing list