Sorry for not being very specific.<br><br>This is the command that Cmake is running while linking : <br><br>/usr/bin/i686-pc-mingw32-g++ -O3 -O3 -Wl,-Bstatic -static-libgcc -Wl,--whole-archive CMakeFiles/sqt2pin.dir/objects.a -Wl,--no-whole-archive -o sqt2pin.exe -Wl,--out-implib,libsqt2pin.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -L/home/fedora/percolator/percolator/src/converters/../../src libconverters.a libperclibrary_part.a MSToolkit/libMSToolkit.a MSToolkit/RAMP/libRAMP.a -lxerces-c -lportablexdr /home/fedora/percolator/percolator/src/converters/libs/dll/libtokyocabinet.a -lz -lsqlite3 -Wl,-Bstatic -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 <br>
/usr/lib/gcc/i686-pc-mingw32/4.5.3/../../../../i686-pc-mingw32/bin/ld: cannot find -lxerces-c<br>/usr/lib/gcc/i686-pc-mingw32/4.5.3/../../../../i686-pc-mingw32/bin/ld: cannot find -lportablexdr<br>/usr/lib/gcc/i686-pc-mingw32/4.5.3/../../../../i686-pc-mingw32/bin/ld: cannot find -lz<br>
/usr/lib/gcc/i686-pc-mingw32/4.5.3/../../../../i686-pc-mingw32/bin/ld: cannot find -lsqlite3<br><br>That is weird cos I "load" all the libraries in the same way and they all the variables content the right paths to the libraries : (for example)<br>
<br>Xercesc : /usr/i686-pc-mingw32/sys-root/mingw/lib/libxerces-c.dll.a , XDR : /usr/i686-pc-mingw32/sys-root/mingw/lib/libportablexdr.dll.a<br><br>This is how I link :<br><br>#COMPILING SQT2PIN<br>include_directories(. MSToolkit/RAMP MSToolkit )<br>
add_executable(sqt2pin Sqt2Pin.cpp )<br>IF(STATIC AND MINGW)<br> set_property(TARGET sqt2pin PROPERTY LINK_SEARCH_END_STATIC ON)<br> set_target_properties(sqt2pin PROPERTIES LINK_FLAGS "-Wl,-Bstatic -static-libgcc")<br>
ENDIF()<br>message(STATUS "Xercesc : ${XERCESC_LIBRARIES} , XDR : ${PORTABLEXDR_LIBRARIES}")<br>target_link_libraries(sqt2pin converters perclibrary_part MSToolkit RAMP ${XERCESC_LIBRARIES} ${PORTABLEXDR_LIBRARIES} ${TOKYOCABINET_LIBRARIES} )<br>
<br>I might be missing something very stupid because I use the same prodecure to search for the librarys....the FindXXX.cmake macros that are tested and working with other programs. <br><br>Could it be the include_directories("library include dir") which is messing this up? it looks like the linker disregard the path of the library that Im pasinng and looks for -lxerces-c instead. Is that xerces-c defined somehow before?<br>
<br>Thank you so much<br><br>Jose<br><br><div class="gmail_quote">2011/10/25 Andreas Pakulat <span dir="ltr"><<a href="mailto:apaku@gmx.de">apaku@gmx.de</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On 25.10.11 13:15:37, Jose wrote:<br>
> Hi all,<br>
><br>
> I'm cross compiling an app under Fedora. I get this linking errors while<br>
> building with cmake :<br>
><br>
> /usr/lib/gcc/i686-pc-mingw32/4.5.3/../../../../i686-pc-mingw32/bin/ld:<br>
> cannot find -lxerces-c<br>
> /usr/lib/gcc/i686-pc-mingw32/4.5.3/../../../../i686-pc-mingw32/bin/ld:<br>
> cannot find -lportablexdr<br>
> /usr/lib/gcc/i686-pc-mingw32/4.5.3/../../../../i686-pc-mingw32/bin/ld:<br>
> cannot find -lz<br>
> /usr/lib/gcc/i686-pc-mingw32/4.5.3/../../../../i686-pc-mingw32/bin/ld:<br>
> cannot find -lsqlite3<br>
><br>
><br>
> The thing is that the libraries have been found,included and linked with<br>
> target_link_libraries. I'm adding all the necessary flags to link statically<br>
> and the libraries are the ones included in the mingw package. It shoud work<br>
> because a different part of the application that uses almost the same<br>
> libraries is cross compiling perfectly. The cmake files are actually pretty<br>
> much the same so I don't really know what I'm doing wrong. Cmake might be<br>
> missing the libraries or the path of the libraries....<br>
<br>
</div></div>Hmm, -lfoo means the linker will search for a shared library. Linking<br>
static libraries is done by specifying the absolute path to the library<br>
file. How exactly are you calling target_link_libraries and assuming<br>
that you're passing above libraries via cmake-variables whats the<br>
content of those variables?<br>
<br>
Andreas<br>
<font color="#888888"><br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</font></blockquote></div><br>