build - Can someone expand what is meant by 'configure' and 'build' with CMake files
问题描述
I am downloading this code from GitHub (subdivision-regression), and am getting stuck following the instructions:
To build doosabin_regression:
Run CMake with an out of source build.
Set COMMON_CPP_INCLUDE_DIR to the full path to rstebbing/common/cpp.
Set DOOSABIN_INCLUDE_DIR to the full path to rstebbing/subdivision/cpp/doosabin/include.
Set Ceres_DIR to the directory containing CeresConfig.cmake.
Set GFLAGS_INCLUDE_DIR, GFLAGS_LIBRARY and RAPID_JSON_INCLUDE_DIR. (Add -std=c++11 to CMAKE_CXX_FLAGS if compiling with gcc.)
Configure.
Build.
I have edited the CMakeLists.txt
file to put the correct paths in. I then created a new directory called subdivision-regression-bin
and ran:
cmake ../subdivision-regression/src
It completes this and displays:
-- Configuring done
-- Generating done
-- Build files have been written to: /home/hert5584/RStebbing/subdivision-regression-bin
However, when I try and run the example code, it cannot find the files listed in CMakeLists.txt
(I know they are the right paths as otherwise CMake does not run).
I have tried running:
sudo make install
But get the following error:
make: *** No rule to make target 'install'. Stop.
Any ideas why this isn't working? Have the above steps Configured and Built the files?
解决方案
要理解的有序 CMake 习惯用法是:
- 配置步骤_
- 生成步骤(这通常包含在配置步骤中,并且在本例中未明确提及。)
- 构建步骤(您在其中实际将代码编译/链接到库/可执行文件中)
查看此资源以获取有关配置和生成阶段的信息。
您似乎没有执行设置 CMake 缓存变量的步骤。对于这些,您必须使用 CMake 命令行选项(-D
特别是)。所以像这样运行 CMake 来设置所有六个变量:
cmake -DCOMMON_CPP_INCLUDE_DIR=/rstebbing/common/cp -DDOOSABIN_INCLUDE_DIR=...[More CMake Cache variables]... ../subdivision-regression/src
对于构建,请尝试在make
没有sudo
或的情况下运行install
:
make
推荐阅读
- python - 删除数组Python项目中逗号前的所有内容
- python - AttributeError:“str”对象没有属性“rotate”
- c# - 用列表中的实际数据替换键和值
- apache-kafka - DataStax Cassandra Sink Connector - 根据条件从 Kafka 主题中摄取数据
- python - 如何遍历 pandas 中的多个列并更改值?
- ios - 如何确保预定通知适用于时区和夏令时
- java - 如何在java中使用文件资源管理器选择文件?
- angular - 将在 mat select 中保持多重选择的表单控件设置为 null
- javascript - Google TimeLine 图表样式列类型样式不起作用
- java - 如何在SpringBoot中使用带有额外列的新实体保存实体多对多