[CMake] MinGW - Qt Linking problems
Vitor Vasconcelos Araujo Silva
Vitor.Vasconcelos at loria.fr
Mon May 5 11:40:33 EDT 2008
Hello all,
I'm experiencing weired problems when trying to link my application
with MinGW.
After generate my Makefile I have the Qt libraries added but no -l
options for Qt libraries. My "linking" line is this:
g++ "CMakeFiles/oigui.dir/oigui.cpp.obj" -o oigui.exe
-Wl,--out-implib,liboigui.dll.a
-Wl,--major-image-version,0,--minor-image-version,0 -LZ:\studies
-LC:\Qt\4.3.4-static\lib -lqgarwin C:\Qt\4.3.4-static\lib\libQtCore.a
C:\Qt\4.3.4-static\lib\libQtGui.a C:\Qt\4.3.4-static\lib\libQtXml.a
-lmingw32 -lqtmain -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm
-lwinspool -lmsimg32 -lkernel32 -luser32 -lshell32 -luuid -lole32
-ladvapi32 -lws2_32
With this, I have missing symbols for all calls to Qt functions. Of
course, if I add:
–lQtCore –lQtGui –lQtXml
To my linking line, everything links ok.
This problem does not occurs on Linux with gcc, but only with MinGW. My
point is, am I missing some point in my project's configuration?
I added my CMakeLists.txt to clarify.
Another important remark is that my Qt version is compiled as static.
So, I have no dll's available, only .a files.
Thanks in advance,
--
Vitor VASCONCELOS
Projet QGAR
LORIA / INRIA-Lorraine
Campus Scientifique, BP 239
54506, Vandoeuvre-lès-Nancy, FRANCE
Tel: +33 (0)3 54 95 85 76
---- CMakeLists.txt -----
PROJECT(oigui)
INCLUDE ( CheckIncludeFiles )
INCLUDE ( CheckLibraryExists )
FIND_PACKAGE(Qt4)
ADD_DEFINITIONS (-DQT_STATIC)
INCLUDE_DIRECTORIES ( ${QT_INCLUDE_DIR} )
INCLUDE_DIRECTORIES ( ${QT_QTXML_INCLUDE_DIR} )
INCLUDE_DIRECTORIES ( ${QT_QTCORE_INCLUDE_DIR} )
INCLUDE_DIRECTORIES ( ${QT_QTGUI_INCLUDE_DIR} )
STRING(REGEX REPLACE "/qt_static_test" "" ROOT_DIR ${PROJECT_SOURCE_DIR})
INCLUDE_DIRECTORIES ( ${ROOT_DIR} )
IF(WIN32)
SET(QGAR qgarwin)
SET(MINGW32_LIBS
mingw32
qtmain
gdi32
comdlg32
oleaut32
imm32
winmm
winspool
msimg32
kernel32
user32
shell32
uuid
ole32
advapi32
ws2_32
)
ELSE(WIN32)
SET(QGAR qgar_qt4)
ENDIF(WIN32)
LINK_DIRECTORIES ( ${ROOT_DIR})
LINK_DIRECTORIES ( ${QT_LIBRARY_DIR})
ADD_EXECUTABLE(oigui oigui.cpp)
TARGET_LINK_LIBRARIES(oigui ${QGAR} ${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY} ${MINGW32_LIBS})
More information about the CMake
mailing list