根据Makefile编写cmake CMakeList

时间:2016-09-20 04:20:29

标签: makefile cmake

我正在学习nvidia-video-codec-sdk示例。它通过Makefile管理项目,它在我的计算机上运行良好。

现在,我想使用cmake来管理项目,因此我需要编写CMakeList.txt,但我无法正常使用它。我只是试试NvDecodeGL

CMakeList.txt

cmake_minimum_required(VERSION 2.8.4)
project(NvDecodeGL)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -DINIT_CUDA_GL=1 -g")

find_library(X11_LIBRARY X11 HINTS /usr/lib/x86_64-linux-gnu)
find_library(GL_LIBRARY GL HINTS /usr/lib/x86_64-linux-gnu)
find_library(GLU_LIBRARY GLU HINTS /usr/lib/x86_64-linux-gnu)
find_library(Xmu_LIBRARY Xmu HINTS /usr/lib/x86_64-linux-gnu)
find_library(glut_LIBRARY glut HINTS /usr/lib/x86_64-linux-gnu)
find_library(libGLEW_LIBRARY GLEW HINTS ../common/lib//linux/x86_64)
find_library(pthread_LIBRARY pthread HINTS /usr/lib/x86_64-linux-gnu)

INCLUDE_DIRECTORIES(../common/inc)
INCLUDE_DIRECTORIES(./)

set(SOURCE_FILES
    ../common/src/dynlink_cuda.cpp
    ../common/src/dynlink_nvcuvid.cpp
    ../common/src/cudaModuleMgr.cpp
    cudaProcessFrame.cpp
    FrameQueue.cpp
    ImageGL.cpp
    NV12ToARGB_drvapi.cu
    NvDecodeGL.cpp
    VideoDecoder.cpp
    VideoParser.cpp
    VideoSource.cpp
    )

add_executable(NvDecodeGL ${SOURCE_FILES})

target_link_libraries(NvDecodeGL -ldl ${X11_LIBRARY} ${GL_LIBRARY} ${GLU_LIBRARY} ${X11_LIBRARY} ${Xmu_LIBRARY} ${glut_LIBRARY} ${libGLEW_LIBRARY} ${pthread_LIBRARY})

错误

undefined reference to `__glewGenProgramsARB' .... 

更新:     现在一切都好。在这个问题上,我犯了两个错误,一个是IDE缓存,另一个是资源相关目录。纠正那些。谢谢大家!

0 个答案:

没有答案