QtCreator 1.3,Qt 4.6.2并在Windows上使用cmake构建问题

时间:2010-02-18 23:40:34

标签: qt cmake qt-creator

我正在尝试从QtCreator构建一个cmake项目。当我打开项目时,我需要给cmake一个参数,否则Qt没有被检测到:     -DQT_QMAKE_EXECUTABLE = d:/Qt/4.6.2/bin/qmake.exe

构建步骤因此错误而停止:

Running build steps for project CollidingMice...
Starting: D:/Qt/2010.02/bin/jom.exe 
"C:\Programmi\CMake 2.8\bin\cmake.exe" -HC:\devel\SRC\collidingmice_cmake -BC:\devel\SRC\collidingmice_cmake\qtcreator-build --check-build-system CMakeFiles\Makefile.cmake 0
"C:\Programmi\CMake 2.8\bin\cmake.exe" -E cmake_progress_start C:\devel\SRC\collidingmice_cmake\qtcreator-build\CMakeFiles C:\devel\SRC\collidingmice_cmake\qtcreator-build\CMakeFiles\progress.marks
D:\Qt\2010.02\bin\jom.exe -f CMakeFiles\Makefile2 /nologo - all
D:\Qt\2010.02\bin\jom.exe -f CMakeFiles\collidingmice.dir\build.make /nologo -L CMakeFiles\collidingmice.dir\depend
"C:\Programmi\CMake 2.8\bin\cmake.exe" -E cmake_progress_report C:\devel\SRC\collidingmice_cmake\qtcreator-build\CMakeFiles 4
[ 25] Generating qrc_mice.cxx
d:\Qt\4.6.2\bin\rcc.exe -name mice -o C:/devel/SRC/collidingmice_cmake/qtcreator-build/qrc_mice.cxx C:/devel/SRC/collidingmice_cmake/mice.qrc
"C:\Programmi\CMake 2.8\bin\cmake.exe" -E cmake_depends "NMake Makefiles" C:\devel\SRC\collidingmice_cmake C:\devel\SRC\collidingmice_cmake C:\devel\SRC\collidingmice_cmake\qtcreator-build C:\devel\SRC\collidingmice_cmake\qtcreator-build C:\devel\SRC\collidingmice_cmake\qtcreator-build\CMakeFiles\collidingmice.dir\DependInfo.cmake --color=
Scanning dependencies of target collidingmice
D:\Qt\2010.02\bin\jom.exe -f CMakeFiles\collidingmice.dir\build.make /nologo -L CMakeFiles\collidingmice.dir\build
"C:\Programmi\CMake 2.8\bin\cmake.exe" -E cmake_progress_report C:\devel\SRC\collidingmice_cmake\qtcreator-build\CMakeFiles 1
[ 50] Building CXX object CMakeFiles/collidingmice.dir/main.cpp.obj
C:\PROGRA~1\MICROS~1.0\VC\bin\cl.exe     @C:\DOCUME~1\NICOLA~1\IMPOST~1\Temp\main.cpp.obj.461273.jom
jom 0.8.3 - empower your cores

command failed with exit code 2
command failed with exit code 2
command failed with exit code 2
command failed with exit code 2
Exited with code 2.
Error while building project CollidingMice
When executing build step 'Make'

我要构建的项目是collingmice qt示例,它是从qt提示符构建的。这里有CMakeLists:

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(CollidingMice)


################################################# QT4 Handling
FIND_PACKAGE(Qt4 REQUIRED)

#this include set all the qt variable need to compile qt 
INCLUDE(${QT_USE_FILE})

#Put here all headers files that need moc 
SET( Qt4_SRC
)

#Put here .ui form files
SET( Qt4_UI
)

#Put here .qrc resource files
SET( Qt4_RES mice.qrc
)

#Cmake macro 
QT4_WRAP_CPP(MOC_CPP ${Qt4_SRC})
QT4_WRAP_UI(UI_CPP ${Qt4_UI})
QT4_ADD_RESOURCES(RES_H ${Qt4_RES})

################################################# CPack
INCLUDE(InstallRequiredSystemLibraries)

SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "My funky project")
SET(CPACK_PACKAGE_VENDOR "Me, myself, and I")
#SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
#SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
SET(CPACK_PACKAGE_VERSION_MINOR "3")
SET(CPACK_PACKAGE_VERSION_PATCH "2")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
IF(WIN32 AND NOT UNIX)
  # There is a bug in NSI that does not handle full unix paths properly. Make
  # sure there is at least one set of four (4) backlasshes.
  SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp")
  SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe")
  SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} My Famous Project")
  SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.my-project-home-page.org")
  SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.my-personal-home-page.com")
  SET(CPACK_NSIS_CONTACT "me@my-personal-home-page.com")
  SET(CPACK_NSIS_MODIFY_PATH ON)
ELSE(WIN32 AND NOT UNIX)
  SET(CPACK_STRIP_FILES "bin/MyExecutable")
  SET(CPACK_SOURCE_STRIP_FILES "")
ENDIF(WIN32 AND NOT UNIX)
SET(CPACK_PACKAGE_EXECUTABLES "MyExecutable" "My Executable")

INCLUDE(CPack)

################################################# General
SET(CMAKE_BUILD_TYPE Release)

SET(CMAKE_CXX_FLAGS "-Wall")

INCLUDE_DIRECTORIES( . )

SET( SRC
    main.cpp
    mouse.cpp
    ${MOC_CPP}
    ${UI_CPP}
    ${RES_H}
)

SET( LIB
    ${QT_LIBRARIES}
)

ADD_EXECUTABLE(collidingmice ${SRC})
TARGET_LINK_LIBRARIES( collidingmice ${LIB} )

1 个答案:

答案 0 :(得分:1)

从Jom输出中不清楚错误是什么。

尝试运行最新版本的Qt Creator(2.0),并将Qt bin /目录添加到PATH中。