[Cmake] Running a different program for the linker (purify on sun)

Bill Hoffman bill . hoffman at kitware . com
Mon, 23 Jun 2003 08:14:02 -0400


The way to run an extra program in front of the link line,
is to change the rule variable CMAKE_CXX_LINK_EXECUTABLE,
and CMAKE_C_LINK_EXECUTABLE.   The values for these
variables can be found in Modules/CMakeDefaultMakeRuleVariables.cmake,
and are sometimes redefined in Modules/Platform/*.cmake.  Make
sure it is set after the PROJECT comamand.

Here is a small example:

PROJECT(foo)

SET(CMAKE_CXX_LINK_EXECUTABLE
    "purify <CMAKE_CXX_COMPILER> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <FLAGS> <OBJECTS>  -o <TARGET> <LINK_LIBRARIES>")
ADD_EXECUTABLE(foo foo.cxx)


Of course, for a real CMakeLists.txt file you should have some IF checks
for the correct platform, this will only work for the makefile generators, the
rule variables are not used by the IDE generators.

-Bill

At 05:25 AM 6/23/2003, Stefan Rank wrote:
>My version of purify purify.sol.2002a.06.00 has to be called for linking.
>
>I'm using cmake 1.6.7
>
>CMakeLists.txt:
>SET (CMAKE_CXX_COMPILER "purify ${CMAKE_CXX_COMPILER}")
>Makefile:
>purify\ c++     -g -Wno-deprecated  -fPIC  $(contpack_api_SRC_OBJS)  ...
>
>CMakeLists.txt:
>SET (CMAKE_CXX_COMPILER 'purify ${CMAKE_CXX_COMPILER}')
>Makefile:
>'purify;c++'     -g -Wno-deprecated  -fPIC  $(contpack_SRC_OBJS)   ...
>
>Both commands don't work in my tcsh.
>
>Stefan
>
>
>Bill Hoffman wrote:
>>I thought that purify was not even needed for linking any more.
>>You just run "purify executable" and it should work.  And purify
>>should not need to be involved with the build process at all.
>>What version of cmake are you using?
>>-Bill
>>
>>At 05:11 PM 6/20/2003, Stefan Rank wrote:
>>
>>>Even with the close quote the set command inserts a semicolon after purify. You are right, purify is only necessary when linking.
>>>Is it possible to cmake to replace the standard linker command with my own linker command.
>>>
>>>Stefan
>>>
>>>Bill Hoffman wrote:
>>>
>>>>With a close quote at the end, that should work.
>>>>However, setting the compiler is a bit tricker because
>>>>cmake needs to know what compiler you are using.
>>>>I thought purify was not required on the command line
>>>>of compiles anymore.
>>>>-Bill
>>>>
>>>>At 07:47 AM 6/19/2003, Stefan Rank wrote:
>>>>
>>>>
>>>>>Hi,
>>>>>
>>>>>how can I preserve spaces in variables during a set command,
>>>>>e.g. SET (CMAKE_CXX_COMPILER "purify ${CMAKE_CXX_COMPILER})
>>>>>
>>>>>Thanks,
>>>>>Stefan
>>>>>
>>>>>_______________________________________________
>>>>>Cmake mailing list
>>>>>Cmake at public . kitware . com
>>>>>http://public . kitware . com/mailman/listinfo/cmake
>>>>
>>
>