linux环境下编译jsoncpp的cmake错误解决

linux环境下编译jsoncpp的cmake错误解决

错误信息

linux下在解压的jsoncpp文件夹中执行:

sudo cmake CMakeList.txt

先看一下报错情况:

-- The CXX compiler identification is GNU 9.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- JsonCpp Version: 1.9.5
######################################################
# jsoncpp should not be configured & built in the jsoncpp source directory
# You must run cmake in a build directory.
# For example:
# mkdir jsoncpp-Sandbox ; cd jsoncpp-sandbox
# git clone https://github.com/open-source-parsers/jsoncpp.git # or download & unpack the source tarball
# mkdir jsoncpp-build
# this will create the following directory structure
#
# jsoncpp-Sandbox
#  +--jsoncpp
#  +--jsoncpp-build
#
# Then you can proceed to configure and build
# by using the following commands
#
# cd jsoncpp-build
# cmake ../jsoncpp # or ccmake, or cmake-gui 
# make
#
# NOTE: Given that you already tried to make an in-source build
#       CMake have already created several files & directories
#       in your source tree. run 'git status' to find them and
#       remove them by doing:
#
#       cd jsoncpp-Sandbox/jsoncpp
#       git clean -n -d
#       git clean -f -d
#       git checkout --
#
######################################################
CMake Error at include/PreventInSourceBuilds.cmake:41 (message):
  Quitting configuration
Call Stack (most recent call first):
  include/PreventInSourceBuilds.cmake:45 (AssureOutOfSourceBuilds)
  CMakeLists.txt:81 (include)


-- Configuring incomplete, errors occurred!

初步分析

根据上述信息分析:
在这里插入图片描述

不能在解压的源文件中进行编译,于是按照上述要求进行目录创建。
结果:失败,仍是相同的报错

解决方案

Domoticz问题原址
GitHub代码详情页
将CMakeList.txt的报错位置注释掉(目前暂不清楚副作用,如有更优方案欢迎提出)

随后进行编译:

sudo cmake CMakeList.txt

在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值