我找到了一个很好的答案,关于如何使用 CMake 在 Qt 中找到可执行文件,cmake not find Qt4
你如何使用 CMAKE_INCLUDE_PATH?我试过了,但我得到了一个错误:
cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../cmake_modules)
project(vrvu)
find_package(OpenGL REQUIRED)(CMAKE_INCLUDE_PATH <--- this is where I'm getting an error
C:\QtSDK\Desktop\Qt\4.8.0\msvc2010\bin)find_package(Qt4 COMPONENTS QtCore QtGui QtOpenGL REQUIRED)
include(${QT_USE_FILE})
find_package(Coin3 REQUIRED)
find_package(Quarter REQUIRED)
add_subdirectory(bullet-2.77)
add_subdirectory(starlight)
file(GLOB SOURCES "*.cpp" "*.cxx" "*.h" "*.hpp")
include_directories(${OPENGL_INCLUDE_DIR} ${QT_INCLUDE_DIR} ${COIN_INCLUDE_DIR} ${QUARTER_INCLUDE_DIR} "./bullet-2.77/src" "./starlight")
link_directories(${QT_LIB_DIR} ${COIN_LINK_DIRECTORIES} ${QUARTER_LINK_DIRECTORIES})
add_definitions(${QT_DEFINITIONS} ${COIN_DEFINITIONS} ${QUARTER_DEFINITIONS})
add_executable(vrvu ${SOURCES})
target_link_libraries(vrvu ${OPENGL_LIBRARIES} ${QT_LIBRARIES} ${COIN_LIBRARIES} ${QUARTER_LIBRARIES} LinearMath BulletCollision starlight)
抱歉,代码太长了……谢谢!