[CMake] how to use a cross linker

abhijeet mhatre abhijeetmhatre at yahoo.com
Tue Jun 5 06:25:41 EDT 2007


Hi
  I am using cmake for sometime now and I am quite impressed by it.
there are yet some areas that I need to understand more.

If I am using  a cross linker, say ld-m68k .. how do I incorporate it into the cmake process? 
it seems that cmake assumes that the compiler itself will do the linking.

regards
Abhijeet


abhijeet mhatre <abhijeetmhatre at yahoo.com> wrote: Hi  list
  I am using cmake as a tool for generating Linux makefiles.

I read the documentation and made a CmakeLists.txt file.
but when I do a cmake . , I get  errors

here is the CmakeLists.txt file 
----------------------
PROJECT(myproject)
SET_TARGET_PROPERTIES(HelloWorld PROPERTIES LINKER_LANGUAGE CXX)
INCLUDE_DIRECTORIES(../dcmtk-3.5.4/dcmnet/apps  ../dcmtk-3.5.4/dcmnet/include ../dcmtk-3.5.4/dcmdata/include ../dcmtk-3.5.4/dcmdata ../dcmtk-3.5.4/ofstd/include ../dcmtk-3.5.4/config/include)
ADD_DEFINITIONS(-DHAVE_CONFIG_H -DNDEBUG -D_REENTRANT -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=199506L)
LINK_DIRECTORIES(../dcmtk-3.5.4/dcmnet/libsrc ../dcmtk-3.5.4/dcmdata/libsrc ../dcmtk-3.5.4/ofstd/libsrc ../dcmtk-3.5.4/dcmtls/libsrc)
TARGET_LINK_LIBRARIES(HelloWorld dcmnet dcmdata ofstd z wrap dcmtls dl m rt pthread nsl)
ADD_EXECUTABLE(HelloWorld  HelloWorld.cpp)
--------------------

and here are the errors
--------------------
CMake Error: Attempt to add link library "dcmnet" to target "HelloWorld" which is not built by this project.
CMake Error: Attempt to add link library "dcmdata" to target "HelloWorld" which is not built by this project.
....
---------------------

Agreed that I am linking to a library that's not built by CMake. But shouldn't I be allowed to do it?

Could anyone please help me on this.
I am using cmake version 2.4-patch 6 on Fedora Core 6

Regards
Abhijeet


   

---------------------------------
Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food & Drink Q&A.

       
---------------------------------
Pinpoint customers who are looking for what you sell. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070605/ab16ea48/attachment.html


More information about the CMake mailing list