[CMake] Linux TARGET_LINK_LIBRARIES bug
Brandon J. Van Every
bvanevery at gmail.com
Tue Jan 30 05:21:16 EST 2007
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
More information about the CMake
mailing list