[CMake] How to use Purify with CMake.

Ben Boeckel ben.boeckel at kitware.com
Thu Oct 14 19:11:37 EDT 2010


william.crocker at analog.com <william.crocker at analog.com> wrote:
> Hello:
> 
> I needed to build a purified version of my test program.
> A search of the mailing list archives produced a number of
> options, but they all had drawbacks.
> 
> I came upon the solution below which seems to work well.
> I introduce a new language "PURIFY" for the purposes
> of linking the purified executable.
> 
> Any comments?
> 
> Bill

Something like this is probably better (crudely adapted from something
like this for test executables from here[1]):

macro (purify exename)
    add_custom_target(purify-${exename})
    add_custom_command(
        TARGET  purify-${exename}
        COMMAND purify
                ${purify_arguments}
                ${EXECUTABLE_OUTPUT_PATH}/${exename}
                ${ARGN}
        WORKING_DIRECTORY
                ${CMAKE_BINARY_DIR}
        COMMENT "Running purify on \"${exename}\"")
    add_dependencies(purify-${exename}
        ${exename})
endmacro (purify)

[1]http://git.benboeckel.net/?p=chasmd.git;a=blob;f=cmake/test.cmake



More information about the CMake mailing list