I'm trying to build the Visual Studio project for a kinect demo thing, rgbddemo. According to the instructions on the page, I need to se开发者_开发技巧t the PATH variable to include QMAKE from QT. I did that, but I keep getting this error:
CMake Error at CMakeLists.txt:1 (QT4_WRAP_CPP): Unknown CMake command "QT4_WRAP_CPP".
From what I could gather from google, it's a problem with CMake knowing where something from QT is. The page I linked above also mentions that you can set the path for QMAKE within CMake, but I don't know how to do that. Does anyone have any suggestions? Thanks.
You could try inserting the line
FIND_PACKAGE(Qt4)
into the top-level CMakeLists.txt file after the line
INCLUDE("${nestk_BINARY_DIR}/UseNestk.cmake")
That should cause it to try to find qmake
for you. I'm not sure why they don't have that though, but then I'm not that familiar with cmake.
I think this lines in your CMakeLists.txt
file can help you.
find_package(Qt4 Required)
include(${QT_USE_FILE}) #contains path to Qt header
#...
qt4_wrap_cpp(MOC_SOURCES ${MY_HEADERS}) #invoking moc
add_library(MY_LIB ${SOURCES} ${MOC_SOURCES}) #building lib
target_link_libraries(MY_LIB ${QT_LIBRARIES})
qt4_add_resources(MY_QT_RSC ${RESOURCES}) #if you want to compile from resource files
add_library(MY_LIB_2 ${MY_QT_RSC} {SOURCES})
精彩评论