我在使用 Cmake 构建项目时遇到问题,这是我以前从未做过的。我是 C++ 以及 Cmake 和 Makefile 概念的新手。我正在尝试从 GitHub 上的一些代码重新创建一些结果。如果您想更详细地查看说明/文件,可以在此处找到:
https://github.com/jan-dufek/Fotokite
所以基本上他列出了四个步骤:
1-)安装CMake:
2-)在终端中,将目录更改为项目的根目录并运行以下命令生成makefile:
制作。
3-) 编译项目:
制作
4-) 运行:
./Fotokite
基本上我现在被困在第二步,因为在导航到文件夹并运行“cmake .”后,我的终端中不断出现以下错误。
The C compiler identification is AppleClang 11.0.3.11030032
The CXX compiler identification is AppleClang 11.0.3.11030032
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
Detecting C compile features
Detecting C compile features - done
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
Detecting CXX compile features
Detecting CXX compile features - done
CMake Error at CMakeLists.txt:5 (find_package):
By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "OpenCV", but
CMake did not find one.
Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.
我也将 OpenCV 下载到我的桌面上,我尝试将路径合并到 Cmake 文件中,但仍然没有任何运气。
这里也是 Cmakelists.txt:
cmake_minimum_required(VERSION 2.8)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
project(Fotokite)
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
file(GLOB SOURCES
*.h
*.hpp
*.cpp
)
list(FILTER SOURCES EXCLUDE REGEX "main.*.cpp")
list(FILTER SOURCES EXCLUDE REGEX "Visualization.*")
foreach (FILE "" Takeoff GoToWaypoint ExecutePath Land)
add_executable(Fotokite${FILE} ${SOURCES} main${FILE}.cpp)
target_link_libraries(Fotokite${FILE} ${OpenCV_LIBS} pthread)
endforeach(FILE)
第一次在这个网站上发帖,如果有什么不清楚的地方,我很抱歉,如果可以的话,我可以提供更多的细节!期待您的回复。