[CMake] Qt4/Windows problems

oleg dashevskii be9-ml at be9.ru
Wed Jan 17 13:23:55 EST 2007


Hi there,

I'm trying to switch from qmake to CMake for my Qt4 based development. For
learning purposes I decided to build DockWidgets example from Qt examples
directory.

Here's my CMakeLists.txt:

=== cut ===
project(DockWidgets)

cmake_minimum_required(VERSION 2.4.0)
find_package(Qt4 REQUIRED)

include(${QT_USE_FILE})

set(SRCS
        main.cpp
        mainwindow.cpp
)
set(MOCABLES mainwindow.h)

QT4_WRAP_CPP(MOCSRCS ${MOCABLES})
QT4_ADD_RESOURCES(RESSRCS dockwidgets.qrc)

add_executable(DockWidgets ${SRCS} ${MOCSRCS} ${RESSRCS})

TARGET_LINK_LIBRARIES(
        ${QT_LIBRARIES}
)
=== cut ===

And here's what I get when running CMake (using MSVC compiler):

CMake Error: Attempt to add link library "C:/Qt/4.2.2co/lib/QtGui4.lib" to
target "optimized" which is not built by this project.
CMake Error: Attempt to add link library "C:/Qt/4.2.2co/lib/QtGuid4.lib"
to target "optimized" which is not built by this project.
CMake Error: Attempt to add link library "Imm32" to target "optimized"
which is not built by this project.
CMake Error: Attempt to add link library "Winmm" to target "optimized"
which is not built by this project.
CMake Error: Attempt to add link library "C:/Qt/4.2.2co/lib/QtCore4.lib"
to target "optimized" which is not built by this project.
CMake Error: Attempt to add link library "C:/Qt/4.2.2co/lib/QtCored4.lib"
to target "optimized" which is not built by this project.
CMake Error: Attempt to add link library "Ws2_32" to target "optimized"
which is not built by this project.

I also tried to use MinGW compiler with Qt OpenSource edition. Got
something alike:

CMake Error: Attempt to add link library "Imm32" to target
"C:/Qt/4.2.2os/lib/libQtGui4.a" which is not built by this project.
CMake Error: Attempt to add link library "Winmm" to target
"C:/Qt/4.2.2os/lib/libQtGui4.a" which is not built by this project.
CMake Error: Attempt to add link library "C:/Qt/4.2.2os/lib/libQtCore4.a"
to target "C:/Qt/4.2.2os/lib/libQtGui4.a" which is not built by this
project.
CMake Error: Attempt to add link library "Ws2_32" to target
"C:/Qt/4.2.2os/lib/libQtGui4.a" which is not built by this project.

That was CMake 2.4.6. Then I obtained, built and run latest CVS snapshot,
only to receive same errors.

Oleg.



More information about the CMake mailing list