Hi,

I am a new one for cmake. Now I am using Qt 4.3.0 rc 1 Commercial
Edition(VS2005) + Microsoft Visual C++ 2005 Express Edition on Windows
XP SP2.

cmake 2.4 patch 6

I just used one example code of Qt 4, analogclock. Following is my
CMakeList.txt:

project (analogclock)
find_package(Qt4 REQUIRED)
include_directories(${QT_INCLUDES})
target_link_libraries(analogclock ${QT_LIBRARIES})
set(analogclock_SRCS main.cpp analogclock.cpp)
set(analogclock_MOC_HDRS analogclock.h)
qt4_wrap_cpp(analogclock_MOC_SRCS ${analogclock_MOC_HDRS})
add_executable(analogclock ${analogclock_SRCS} ${analogclock_MOC_SRCS})

Then I changed to this directory to run "cmake .". All is ok, then I
open VC 2005 EE to open analogclock.sln. Then "Build" -> "Build
Solution".

Compile is ok, but link failed, it doesn't link QtCored4.lib and
QtGuid4.lib, many failed errors.

And if I edit the project setting to add these two libs, then it's ok.

I had tried another way, I changed one line in the CMakeList.txt:
target_link_libraries(analogclock ${QT_LIBRARIES}
${QT_QTCORE_LIBRARIES} ${QT_QTGUI_LIBRARIES})

But I got error when I run "cmake .":
-- Found Qt-Version 4.3.0rc1
CMake Error: Attempt to add link library
"D:/liangqi/qt/Qt/4.3.0rc1/lib/QtCore4.lib" to target "analogclock"
which is not built by this project.
CMake Error: Attempt to add link library
"D:/liangqi/qt/Qt/4.3.0rc1/lib/QtCored4.lib" to target "analogclock"
which is not built by this project.
CMake Error: Attempt to add link library
"D:/liangqi/qt/Qt/4.3.0rc1/lib/QtGui4.lib" to target "analogclock"
which is not built by this project.
CMake Error: Attempt to add link library
"D:/liangqi/qt/Qt/4.3.0rc1/lib/QtGuid4.lib" to target "analogclock"
which is not built by this project.
-- Configuring done

But how can I do it in cmake? Or do you have any suggestion about it? Thanks.

Regards,
Liang

--
My Blog: http://cavendishqi.blogspot.com
KDE China: http://www.kdecn.org
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to