[CMake] help with shared-lib make failure

luxInteg lux-integ at btconnect.com
Sat Jun 16 19:39:30 EDT 2012


On Saturday 16 June 2012 09:45:56 luxInteg wrote:
> Greetings,
> 
> Its been about 1 year since  since I had a go at learning cmake.
> My current setup has these:- OS 64bit(AMD) cblfs linux, gcc-4.4.2,
> cmake-2.8.7
> 
> This is my current problem:
> My project has a  file  call this file1.c.
> CMake is used o generate makefile etc
> 
> When make  compiles file1.c  it compiles it to  file1.c.o
> 
> I have these directives in the CMake script
> 
> --1--add_library(file1-static  file1.c)
> --2--add_library(file1  shared file1.c)
> 
> --1-- executes and genetates a static library but  with --2-- I now get the
> error
> 
> usr/bin/ld/CMakeFiles/... file1.c.o  file format not recognised  treating
> as a linker script
> usr/bin/ld/CMakeFiles/... file1.c.o:1 syntax error
> collect2 ld returned 1 exit status
> 
> 
> I never had this problem before so advice on what I  have wrong or doing
> wrong would be much appreciated.
> 
The linker for my project seems to require the object file(s) as    file1.o as 
opposed to file1.c.o othewise it will not make a shared library.
I tried setting CMAKE_R_PATH as "${CMAKE_INSTALL_PREFIX}/lib" and fiddled 
around with set_target_properties()  to no avail.

So are there simple scripts that can  convert the file1.c.o ihto file1.o  or 
symlink to file1.o in  
in the ${PROJECT_BINARY_DIR}  to execute  just after compilation and before 
linking?

thanks in advance
luxInteg


More information about the CMake mailing list