Jsoncpp Development Environment Construction

Source: Internet
Author: User
Tags doxygen

Environment Setting Project address

Https://github.com/open-source-parsers/jsoncpp.git

Operating system
64位 Fedora 24
Installing Jsoncpp
$ git clone https://github.com/open-source-parsers/jsoncpp.git$ cd jsoncpp/$ mkdir -p build/debug$ cd build/debug$ cmake -DCMAKE_BUILD_TYPE=debug -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF ../..$ make$ sudo make install### 设置pkg-config查找路径$ tail -n 8 .bash_profilePKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfigexport PKG_CONFIG_PATHLD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:$LD_LIBRARY_PATHexport LD_LIBRARY_PATH$ source ~/.bash_profile### 生成帮助文档,web文档的index.html在当前目录%DOC_TOPDIR%/%HTML_OUTPUT%下$ sudo yum install -y doxygen$ doxygen web_doxyfile.in
Project catalog structure (template)
$ lsCMakeLists.txt  main.cpp$ cat CMakeLists.txt#cmake的最低版本cmake_minimum_required(VERSION 2.8)#工程名project(jsoncpp)include(CheckCXXCompilerFlag)CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)if(COMPILER_SUPPORTS_CXX11)    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")elseif(COMPILER_SUPPORTS_CXX0X)    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")else()        message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")endif()#遍历当前目录及子目录获取所有源文件file(GLOB SRC "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")#设置源文件列表add_executable(sample ${SRC})#dependenciesINCLUDE(FindPkgConfig)#使用pkg-config寻找protobuf库的include目录以及库pkg_check_modules(JSONCPP REQUIRED jsoncpp)include_directories(${JSONCPP_INCLUDE_DIRS})link_directories(${JSONCPP_LIBRARY_DIRS})#设置链接库target_link_libraries(sample ${JSONCPP_LIBRARIES})
Compiling a Run project (template)
$ mkdir build$ cd build$ cmake ..$ make$ ./sample

Jsoncpp Development Environment Construction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.