开发者

QtCreator 1.3, Qt 4.6.2 and build problem with cmake on windows

开发者 https://www.devze.com 2022-12-20 11:21 出处:网络
I\'m trying to build a cmake project from QtCreator. When I open the project I need to give an argument to cmake otherwise Qt is not detected:

I'm trying to build a cmake project from QtCreator. When I open the project I need to give an argument to cmake otherwise Qt is not detected: -DQT_QMAKE_EXECUTABLE=D:/Qt/4.6.2/bin/qmake.exe

The build step halts with this error:

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.0开发者_JAVA百科2\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'

The project I'm tring to build is the collingmice qt example and it builds from qt prompt. Here there is the 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} )


It's not clear from the Jom output what the error is.

Try running the latest version of Qt Creator (2.0) and also adding the Qt bin/ directory into your PATH.

0

精彩评论

暂无评论...
验证码 换一张
取 消