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


---------- In a shared, included definitions file.

set( PURIFY_CACHE_DIR /tmp )
set( PURIFY_COMMAND "purify -always-use-cache-dir=yes 
-cache-dir=${PURIFY_CACHE_DIR}" )
set( CMAKE_PURIFY_LINK_EXECUTABLE "${PURIFY_COMMAND} 
${CMAKE_CXX_LINK_EXECUTABLE}" )
set( CMAKE_PURIFY_FLAGS         ${CMAKE_CXX_FLAGS}         )
set( CMAKE_PURIFY_FLAGS_DEBUG   ${CMAKE_CXX_FLAGS_DEBUG}   )
set( CMAKE_PURIFY_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE} )


---------- In the CMakeList.txt file for a specific component.

# Build the regular test program.
#
add_executable( xyz_test EXCLUDE_FROM_ALL test.cc )
target_link_libraries( xyz_test xyz )

# Build a purified version of the test program.
#
add_executable( xyz_test_pure EXCLUDE_FROM_ALL test.cc )
target_link_libraries( xyz_test_pure xyz )
set_target_properties( xyz_test_pure PROPERTIES LINKER_LANGUAGE PURIFY )
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to