[CMake] Checking Disk space with Cmake
avner cohen
avcoh at yahoo.com
Tue Aug 11 04:08:38 EDT 2009
Thank you very much Eric, this defiently helps.
My problem now is that I want my "<your_check_disk_command>" to be a MACRO/FUNCTION if already written in my cmake scripts (rather than running a shell script) is that possible ?
Thanks in advance,
-Avner.
----- Original Message ----
From: Eric Noulard <eric.noulard at gmail.com>
To: avner cohen <avcoh at yahoo.com>
Cc: cmake at cmake.org
Sent: Tuesday, August 11, 2009 10:16:29 AM
Subject: Re: [CMake] Checking Disk space with Cmake
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
More information about the CMake
mailing list