[CMake] help with shared-lib make failure
Andreas Naumann
Andreas-Naumann at gmx.net
Sun Jun 17 03:35:07 EDT 2012
Am 17.06.2012 01:39, schrieb luxInteg:
> 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
> --
>
> 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
>
>
Hallo Lux,
can you set the Makefiles to verbose mode, i.e. set the variabe
CMAKE_VERBOSE_MAKEFILE to true and post the link commands?
Possibly there is some error when using the linker.
Regards
Andreas Naumann
More information about the CMake
mailing list