[CMake] Making with purify

William A. Hoffman billlist at nycap.rr.com
Thu Oct 14 11:37:00 EDT 2004


Currently, there is no way to to make a target optionally part of the all build.
If you are just using make, you might be able to do something like this:

SET(CMAKE_CXX_LINK_EXECUTABLE "$(PURIFY) ${CMAKE_CXX_LINK_EXECUTABLE}")
ADD_EXECUTABLE(my_exe  etc...)

# to build a purified my_exe
rm my_exe
make PURIFY=purify 
# to build the regular my_exe
rm my_exe
make 

The $(PURIFY) variable will be treated as a make variable, and
will expand to nothing when you do not define it on the command line.


-Bill



At 03:52 PM 10/13/2004, Eric Bolz wrote:
>In Mastering CMake, page 56, the example for building a purify version works fine but sometimes I want to build with purify and sometimes I don't.  How is that done?  I can do the following:
>ADD_EXECUTABLE(my_exe  etc...)
>SET(CMAKE_C_LINK_EXECUTABLE "purify  etc...")  as per the example on page 56
>ADD_EXECUTABLE(my_exe.purify  etc...)
>
>But now my makefile produces both the purify and non-purify executables every time.
>I just want to type 'make' to build my regular executable and I want to type 'make purify' when I want the purified version.  Can this be done?
>
>_______________________________________________
>CMake mailing list
>CMake at www.cmake.org
>http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list