[CMake] Linux TARGET_LINK_LIBRARIES bug
Radu Serban
radu at llnl.gov
Tue Jan 30 13:51:46 EST 2007
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)
--Radu
More information about the CMake
mailing list