[CMake] Linux TARGET_LINK_LIBRARIES bug

Brandon J. Van Every bvanevery at gmail.com
Tue Jan 30 14:00:04 EST 2007


Radu Serban wrote:
> Brandon J. Van Every wrote:
>> In my toplevel CMakeLists.txt I have:
>>
>> ADD_SUBDIRECTORY(pcre)
>> ADD_SUBDIRECTORY(boot)
>>
>> in pcre/CMakeLists.txt I build
>>
>>  SET_TARGET_PROPERTIES(libpcre-for-shared PROPERTIES
>>    COMPILE_FLAGS "${SHARED_FLAGS} -fPIC"
>>    OUTPUT_NAME pcre-for-shared)
>>
>> in boot/CMakeLists.txt I link:
>>
>>  TARGET_LINK_LIBRARIES(chicken-boot libchicken-boot libpcre-for-static)
>>
>> This works fine under MinGW, and Cygwin.  It also works under MSVC 
>> with some additional "liblib" code.  Under Linux it dies with
>>
>> Linking C executable chicken-boot
>> /usr/lib/gcc-lib/i586-suse-linux/3.3.3/../../../../i586-suse-linux/bin/ld: 
>>
>> cannot find -llibpcre-for-static
>> collect2: ld returned 1 exit status
>> make[2]: *** [boot/chicken-boot] Error 1
>> make[1]: *** [boot/CMakeFiles/chicken-boot.dir/all] Error 2
>> make: *** [all] Error 2
>>
>> It seems the target name "libpcre-for-static" is not being propagated 
>> from the pcre subdirectory, in a way that TARGET_LINK_LIBRARIES will 
>> pick up.
>>
>>
>> Cheers,
>> Brandon Van Every
>>
>
> I do the exact same thing for my project and have no problems 
> whatsoever...
> (ccmake version 2.4-patch 5)


My colleague Felix actually observed this bug using CMake 2.5 CVS.  I 
haven't tried to reproduce it myself; I'm not entirely swift with my 
Linux setup yet.  Meanwhile, Felix is not certain he can reproduce it.  
He'll report back later.


Cheers,
Brandon Van Every



More information about the CMake mailing list