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

  • Post author:
  • Post category:linux




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

在这里插入图片描述



版权声明:本文为qq_43439665原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。