<br>Hi there<br><br>I tried to use CMake for a small Qt project.<br>Here is my CMalkeLists.txt<br><div>[CODE]</div><div># set project's name<br></div> <br> PROJECT(TeXular)<br> cmake_minimum_required(VERSION 2.8)<br>
<br> SET(CMAKE_BUILD_TYPE Release)<br> <br> # enable warnings<br> # ADD_DEFINITIONS( -c -g -Wall -frtti -fexceptions -mthreads -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc)<br> SET(CMAKE_CXX_FLAGS "-Wall")<br>
<br> # this command finds Qt4 libraries and sets all required variables<br> # note that it's Qt4, not QT4 or qt4<br> FIND_PACKAGE( Qt4 REQUIRED )<br> <br> # by default only QtCore and QtGui modules are enabled<br>
# other modules must be enabled like this:<br> #SET( QT_USE_QTXML TRUE )<br> <br> # add some useful macros and variables<br> # (QT_USE_FILE is a variable defined by FIND_PACKAGE( Qt4 ) that contains a path to CMake script)<br>
INCLUDE( ${QT_USE_FILE} )<br> <br> # with SET() command you can change variables or define new ones<br> # here we define SAMPLE_SRCS variable that contains a list of all .cpp files<br> # note that we don't need \ at the end of line<br>
SET( TEXULAR_SRCS<br> ./src/main.cpp<br>         ./src/MainWindow.cpp<br> ./src/TableModel.cpp<br> )<br> <br> # another list, this time it includes all header files that should be treated with moc<br> SET( TEXULAR_MOC_HDRS<br>
./src/MainWindow.h <br> ./src/TableModel.h<br> )<br> <br> # some .ui files<br> SET( TEXULAR_UIS<br> ./ui/MainWindow.ui<br> )<br> <br> # and finally an resource file<br> # SET( TEXULAR_RCS ./src/rc/sample.qrc)<br>
<br><br> # and finally this will run moc:<br> QT4_WRAP_CPP( TEXULAR_MOC_SRCS ${TEXULAR_MOC_HDRS} )<br> <br> # this will run uic on .ui files:<br> QT4_WRAP_UI( TEXULAR_UI_HDRS ${TEXULAR_UIS} )<br> <br> # this command will generate rules that will run rcc on all files from TEXULAR_RCS<br>
# in result TEXULAR_RC_SRCS variable will contain paths to files produced by rcc<br> #QT4_ADD_RESOURCES( TEXULAR_RC_SRCS ${TEXULAR_RCS} )<br> <br> <br> # we need this to be able to include headers produced by uic in our code<br>
# (CMAKE_BINARY_DIR holds a path to the build directory, while INCLUDE_DIRECTORIES() works just like INCLUDEPATH from qmake)<br> INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} )<br> <br> # here we instruct CMake to build TEXULARexecutable from all of the source files<br>
ADD_EXECUTABLE( texular ${TEXULAR_SRCS} ${TEXULAR_MOC_SRCS} ${TEXULAR_RC_SRCS} ${TEXULAR_UI_HDRS} )<br> <br> # last thing we have to do is to tell CMake what libraries our executable needs,<br> # luckily FIND_PACKAGE prepared QT_LIBRARIES variable for us:<br>
TARGET_LINK_LIBRARIES( texular ${QT_LIBRARIES} )<br><br><div> INSTALL_TARGETS( /bin texular)</div><div>[/CODE]<br></div><br>Then I run:<br><div>[CODE]</div><div>cmake -G"MinGW Makefiles"<br></div><div>mingw32-make.exe</div>
<div>[/CODE]<br></div><br>Everything builds without error.<br>But if I launch my application I get an error :<br><br>The procedure entry point _Z17qt_message_output9QtMsgTypePKc could not be located in the dynamic link library QtCore4.dll<br>
<br>If a check the binary with Dependency Walker and compare with an other binary (created with a qmake makefile) I see that there is Mingw10.dll missing.<br><br>How do I tell cmake to link against Mingw10.dll?<br>Or is the procedure entry point error not because of missing Mingw10.dll?<br>
<br>Platform is Win7 64 bit. Qt Version 4.7<br><br><br>Thanks for your help.<br><br>Cheers LukeS<br>