[CMake] How to use Purify with CMake.

Bill Hoffman bill.hoffman at kitware.com
Thu Oct 14 20:49:42 EDT 2010


On 10/14/2010 7:11 PM, Ben Boeckel wrote:
> william.crocker at analog.com<william.crocker at analog.com>  wrote:

>
> 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
>

Ben, I think the problem is that some versions of purify are run by 
putting purify in front of the final link line.  Like this:

purify gcc -o foo foo.o

Running this:

purify foo

Will not work.  So, you have to do something like what was suggested.

Another way is something like this:

set (CMAKE_CXX_LINK_EXECUTABLE
     "purify ${CMAKE_CXX_LINK_EXECUTABLE}")
add_executable (foo foo.cxx)


-Bill


More information about the CMake mailing list