[CMake] how to use a cross linker

Jun Sun jsun at junsun.net
Wed Jun 13 17:39:55 EDT 2007


I am very interested in the answer too.  In general, I like to know
if cmake can support corss compiling and cross linking.

I am new to cmake. I assume if cmake has the ablility to specify
the compiler and linker, at least the problem is half-solved.

Cheers.

Jun

On Tue, Jun 05, 2007 at 03:25:41AM -0700, abhijeet mhatre wrote:
> 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. 
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list