[CMake] functions & custom commands- what's the trick?

Aaron Turner synfinatic at gmail.com
Fri Feb 20 03:22:59 EST 2009


sample code to illustrate problem:

cmake_minimum_required(VERSION 2.6)
function(clean_standard_files)
    message(STATUS "running clean_standard_files")
endfunction(clean_standard_files)

add_custom_target(standard)
add_custom_command(TARGET standard
    COMMAND clean_standard_files
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    VERBATIM)


then running 'make standard' doesn't work:
make[3]: clean_standard_files: Command not found
make[3]: *** [standard] Error 127
make[2]: *** [CMakeFiles/standard.dir/all] Error 2
make[1]: *** [CMakeFiles/standard.dir/rule] Error 2

I seem to be missing something painfully obvious, but I'm not sure what.

-- 
Aaron Turner
http://synfin.net/
http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix & Windows
Those who would give up essential Liberty, to purchase a little
temporary Safety,
deserve neither Liberty nor Safety.
    -- Benjamin Franklin


More information about the CMake mailing list