forked from boostorg/json
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When building outside of boost, boost_json now supports the install option of cmake. This patch produces a full, correct install which obeys CMAKE_INSTALL_PREFIX and creates the correct config.cmake files in order to construct the target Boost::json This config will automatically find Boost::system using the standard cmake find_package command
- Loading branch information
1 parent
17b4177
commit e74f9bf
Showing
7 changed files
with
171 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@PACKAGE_INIT@ | ||
|
||
set(BOOST_JSON_STANDALONE @BOOST_JSON_STANDALONE@) | ||
|
||
if(NOT BOOST_JSON_STANDALONE) | ||
include(CMakeFindDependencyMacro) | ||
find_dependency(Boost REQUIRED COMPONENTS system) | ||
endif() | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/boost_json-targets.cmake") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright 2018 Peter Dimov | ||
# Copyright 2018 Richard Hodges | ||
# Distributed under the Boost Software License, Version 1.0. | ||
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt | ||
|
||
cmake_minimum_required(VERSION 3.5...3.16) | ||
|
||
project(cmake_install_test LANGUAGES CXX) | ||
|
||
find_package(boost_json REQUIRED) | ||
|
||
add_executable(main main.cpp) | ||
target_link_libraries(main Boost::json) | ||
|
||
enable_testing() | ||
add_test(NAME main COMMAND main) | ||
|
||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2018 Peter Dimov | ||
// Copyright 2020 Richard Hodges | ||
// Distributed under the Boost Software License, Version 1.0. | ||
// See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt | ||
|
||
#include <boost/json.hpp> | ||
#include <cstdio> | ||
|
||
int main() | ||
{ | ||
const boost::json::value value = boost::json::parse("{ \"test\": true }"); | ||
std::puts(boost::json::to_string(value).c_str()); | ||
} |