On 09/13/2011 11:01 AM, Federico Carminati wrote: > Hello Eric, > sorry for not having changed the subject, I realize it only now. Thanks > for your answer. I am trying to use clang / clang++. This works if I do > > cmake $MY_SOURCE_DIRECTORY -DCMAKE_C_COMPILER=clang > -DCMAKE_CXX_COMPILER=clang++ > > however CMake decides to use clang / clang++ as linker, and I need plain ld. > However I am fine with all other flags and arguments. I would just like to > have ld as linker command and not clang / clang++. I tried adding > > -DCMAKE_C_LINK_EXECUTABLE=ld \ > -DCMAKE_CXX_LINK_EXECUTABLE=ld > > with the result that the whole linker command is now just what I specify as > argument to CMAKE_<LANG>_LINK_EXECUTABLE, I do not even have the executable, > object files and libraries any more. Thanks for help and best regards, > > Federico Carminati > CERN-PH > 1211 Geneva 23 > Switzerland > Tel: +41 22 76 74959 > Fax: +41 22 76 68505 > Mobile: +41 76 487 4843
If you just want to replace clang/clang++ with ld in the linker command line and if you can get along with Makefiles, you might use one of the RULE_LAUNCH_LINK properties in order to perform a suitable last-minute modification of the linker command line; see [1] for an example how to tweak command lines in this way. BTW, CMAKE_<LANG>_LINK_EXECUTABLE is a *rule* variable, i.e. it specifies the entire linker command line including flags and object files, not just the linker executable. Regards, Michael [1] http://www.mail-archive.com/[email protected]/msg38085.html > On 13 Sep 2011, at 10:56, Eric Noulard wrote: > >> 2011/9/13 Federico Carminati <[email protected]>: >>> Dear All, >>> is there a way to specify the link command in CMake? If I specify >>> >>> export LD=/usr/bin/ld ; cmake $MY_SOURCE_DIRECTORY >>> >>> it is not taken and if I set >> >> I dont' know if LD env var is supposed to be used at all. >> >>> cmake $MY_SOURCE_DIRECTORY \ >>> -DCMAKE_C_LINK_EXECUTABLE=ld \ >>> -DCMAKE_CXX_LINK_EXECUTABLE=ld >>> >>> what I observe is that the "entire" link command is replaced by "just" ld. >>> Am I missing something? >> >> What are you trying to do? >> Replacing the linker application while keeping the option of the one >> CMake would have chosen? >> Seems weird, if you change linker may be you should specify linker >> option as well, no? >> >> This looks like "incomplete" cross compiling (see >> http://www.cmake.org/Wiki/CMake_Cross_Compiling) >> or unsupported compiler use. >> >> May be you can explain us what you are trying to do. >> and please do not hijack unrelated thread for asking new question. >> >> -- >> Erk >> Membre de l'April - « promouvoir et défendre le logiciel libre » - >> http://www.april.org _______________________________________________ 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
