[CMake] Problem with target_link_libraries

Benoit benpaka.spam at gmail.com
Fri May 8 13:25:04 EDT 2009


Hy guy,

I'm building a project using 2 libraries:

x7scv -> which integrate opencv (dynamically) and libjpeg (statically)
x7sxml -> which integrate tinxml (statically)

The problem is that when i create a program that use theses 2 libraries:

SET(X7S_LIBRARIES "x7snet" "x7scv" "x7sxml")
include_directories(${X7S_INCLUDES} ${OPENCV_INCLUDE_DIR})
add_dependencies(my_prog ${X7S_LIBRARIES})
target_link_libraries(my_prog ${X7S_LIBRARIES} ${OPENCV_LIBRARIES})

I've the following line at GCC:

..\x7s\src\x7scv\libx7scv.dll.a ..\x7s\src\x7sxml\libx7sxml.dll.a
"C:\Archivos de programa\OpenCV\lib\cv.lib" "C:\Archivos de
programa\OpenCV\lib\cxcore.lib" "C:\Archivos de
programa\OpenCV\lib\cvaux.lib" "C:\Archivos de
programa\OpenCV\lib\highgui.lib"
..\3rdparty\lib\liblibjpeg.a ..\3rdparty\lib\libtinyxml.a

And i don't know why it link also with the static library
..\3rdparty\lib\liblibjpeg.a ..\3rdparty\lib\libtinyxml.a because they have
already been linked in ..\x7s\src\x7scv\libx7scv.dll.a
..\x7s\src\x7sxml\libx7sxml.dll.a

So I've a "multiple definition of ..." error.


PS: The library x7sxml is created like this:
set(LIBNAME "x7sxml")
add_library(${LIBNAME} ${SRC_FILES} ${HDR_FILES})
target_link_libraries(${LIBNAME}
"D:/projects/builds/CvS400/ec_mingw/3rdparty/lib/libtinyxml.a")

thanks!!!!

--
Benoit RAT
www.neub.co.nr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090508/1b5bcf7e/attachment.htm>


More information about the CMake mailing list