[CMake] Checking Disk space with Cmake

Eric Noulard eric.noulard at gmail.com
Tue Aug 11 04:23:02 EDT 2009


2009/8/11 avner cohen <avcoh at yahoo.com>:
>
> 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 ?

Almost yes, in fact you cannot "call a macro" in add_custom_target,
however you may put whatever you want in a checkdisk.cmake CMake script file
and then call this script  using CMake -P, like in:

add_custom_target(CheckDisk ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_SOURCE_DIR}/checkdisk.cmake
                  COMMENT "Check available disk space before build"
                  SOURCES checkdisk.cmake)

If you need to pass value to your checkdisk.cmake, then you may use -D
arguments to CMake
and/or configure_file(checkdisk.cmake.in checkdisk.cmake)  in order to
make the called
script contains configured values from your project.


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list