将库.h附加到makefile

时间:2016-12-06 17:52:20

标签: c++ linux makefile cmake

我想在cmake中将库wiringPi.h添加到我的Makefile中,但是cmake没有看到这个标题。

cmake_minimum_required(VERSION 2.8)
project( program )
include_directories(include)
find_package( OpenCV REQUIRED )
add_executable( program program.cpp )
target_link_libraries( program ${OpenCV_LIBS} ) 

项目组织是:

| - CMakeLists.txt
|
| - program.cpp
|
| - wiringPi.h

我该如何将此标题添加到Makefile?

1 个答案:

答案 0 :(得分:0)

这必须适用于您的情况:

cmake_minimum_required(VERSION 2.8)
project(program)
find_package(OpenCV REQUIRED)
add_executable(program program.cpp wiringPi.h)
target_link_libraries(program ${OpenCV_LIBS})

如果您需要更多信息,请阅读此How to properly add include directories with CMake?。你应该阅读官方tuto。请注意2.8是一个非常旧的版本,您应该更新到最新的稳定版。