[CMake] Add pre-existing object file to linker line?

Bill Hoffman bill.hoffman at kitware.com
Sun May 27 15:58:05 EDT 2007


Trevor Kellaway wrote:
> Bill,
>
>   
>> You want to create your own rules for CMAKE_(LANG)_COMPILE_OBJECT:
>>
>> SET(CMAKE_C_COMPILE_OBJECT
>>     "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} 
>> ${CMAKE_CL_NOLOGO} <FLAGS> /Fo<OBJECT> /Fd<TARGET_PDB>  -c 
>> <SOURCE>${CMAKE_END_TEMP_FILE}")
>>
>> Each new line in this is a separate command.   You should 
>> just be able 
>> to append the lint stuff to end end of the existing rule variable.
>>
>> Something like this:
>>
>> set(CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT\} lint <OBJECT>")
>>     
>
> How does CMake know where one command finishes and the next starts? 
>
> You say "each new line" but surely "lint <OBJECT>" above will just be
> treated as extra arguments to the compiler? Or was you example across
> multiple lines and the email merged them?
>   
Email merged them.  For an example see Linux-como.cmake.   Also, I think 
I had it a big wrong...
It should be like this:
"command ..."
"command2 .."
"command3 .."

-Bill



More information about the CMake mailing list