1- cmake_minimum_required ( VERSION 3.10 )
1+ # Copyright (c) Darrell Wright
2+ #
3+ # Distributed under the Boost Software License, Version 1.0. (See accompanying
4+ # file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
5+ #
6+ # Official repository: https://github.com/beached/json_to_cpp
7+ #
28
3- project ( json_to_cpp_prj )
49
5- include ( ExternalProject )
10+ cmake_minimum_required ( VERSION 3.13 )
611
7- find_package ( Boost 1.60.0 COMPONENTS system date_time iostreams program_options filesystem regex unit_test_framework REQUIRED )
12+ project ("json_to_cpp"
13+ VERSION "1.0.0"
14+ DESCRIPTION "Try to use the JSON structures to make C++ structures and bindings"
15+ HOMEPAGE_URL "https://github.com/beached/json_to_cpp"
16+ LANGUAGES C CXX )
817
9- find_package ( CURL )
10- find_package ( Threads REQUIRED )
18+ set (CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard whose features are requested." )
19+ set (CMAKE_CXX_STANDARD_REQUIRED ON )
20+ set (CMAKE_CXX_EXTENSIONS OFF )
1121
12- enable_testing ( )
13- add_definitions ( -DBOOST_TEST_DYN_LINK )
22+ find_package ( Boost 1.60.0 COMPONENTS program_options REQUIRED )
23+ find_package ( CURL REQUIRED )
24+ find_package ( OpenSSL REQUIRED )
25+ add_subdirectory (extern )
1426
15-
16- set ( CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard whose features are requested." )
17-
18- include ( "${CMAKE_SOURCE_DIR} /dependent_projects/CMakeListsCompiler.txt" )
19-
20- if ( "${CMAKE_BUILD_TYPE} " STREQUAL "Debug" )
21- set ( GLEAN_CACHE "${CMAKE_SOURCE_DIR} /.glean/debug" )
22- set ( GLEAN_CACHE2 "${CMAKE_SOURCE_DIR} /.glean/release" )
23- elseif ( "${CMAKE_BUILD_TYPE} " STREQUAL "Release" )
24- set ( GLEAN_CACHE "${CMAKE_SOURCE_DIR} /.glean/release" )
25- set ( GLEAN_CACHE2 "${CMAKE_SOURCE_DIR} /.glean/debug" )
26- else ( )
27- set ( GLEAN_CACHE "${CMAKE_SOURCE_DIR} /.glean/release" )
28- set ( GLEAN_CACHE2 "${CMAKE_SOURCE_DIR} /.glean/debug" )
29- endif ( )
30-
31- message ( "Building for: ${CMAKE_BUILD_TYPE} " )
32- message ( "Checking for glean cache: '${GLEAN_CACHE} '" )
33- if ( EXISTS "${GLEAN_CACHE} " )
34- message ( "using glean dependencies at ${GLEAN_CACHE} " )
35- add_custom_target ( dependency_stub )
36- include_directories ( SYSTEM "${GLEAN_CACHE} /include" )
37- link_directories ( "${GLEAN_CACHE} /lib" )
38- elseif ( EXISTS "${GLEAN_CACHE2} " )
39- message ( "looks like glean is in use but missing ${GLEAN_CACHE} " )
40- elseif ( EXISTS "${CMAKE_SOURCE_DIR} /glean.cmake" )
41- message ( "glean.cmake detected" )
42- include ( "${CMAKE_SOURCE_DIR} /glean.cmake" )
43- add_library ( dependency_stub STATIC "${CMAKE_SOURCE_DIR} /dependent_projects/stub.cpp" )
44- add_dependencies ( dependency_stub ${DEP_PROJECT_DEPS} )
45- include_directories ( SYSTEM "${CMAKE_BINARY_DIR} /install/include" )
46- link_directories ( "${CMAKE_BINARY_DIR} /install/lib" )
47- endif ( )
48-
49- set ( HEADER_FOLDER "include" )
50- set ( SOURCE_FOLDER "src" )
51- set ( TEST_FOLDER "tests" )
52-
53- include_directories ( SYSTEM "${CMAKE_BINARY_DIR} /install/include" )
54- include_directories ( ${HEADER_FOLDER} )
55- include_directories ( SYSTEM ${OPENSSL_INCLUDE_DIR} )
56- include_directories ( SYSTEM ${CURL_INCLUDE_DIRS} )
57- include_directories ( SYSTEM ${Boost_INCLUDE_DIRS} )
58-
59- link_directories ( "${CMAKE_BINARY_DIR} /install/lib" )
60- link_directories ( ${Boost_LIBRARY_DIRS} )
27+ set ( HEADER_FOLDER include )
28+ set ( SOURCE_FOLDER src )
6129
6230set ( HEADER_FILES
6331 ${HEADER_FOLDER} /curl_t.h
@@ -82,17 +50,22 @@ set( SOURCE_FILES
8250 ${SOURCE_FOLDER} /ti_array.cpp
8351 ${SOURCE_FOLDER} /ti_kv.cpp
8452 ${SOURCE_FOLDER} /ti_object.cpp
53+ ${SOURCE_FOLDER} /main.cpp
8554)
8655
87- add_library ( json_to_cpp_lib ${HEADER_FILES} ${SOURCE_FILES} )
88- add_dependencies ( json_to_cpp_lib dependency_stub )
89- target_link_libraries ( json_to_cpp_lib utf_range utf_string ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
90-
91- add_executable ( json_to_cpp ${HEADER_FILES} ${SOURCE_FOLDER} /main.cpp )
92- add_dependencies ( json_to_cpp dependency_stub )
93- target_link_libraries ( json_to_cpp json_to_cpp_lib parse_json utf_range ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CURL_LIBRARIES} )
56+ add_executable ( ${PROJECT_NAME} ${HEADER_FILES} ${SOURCE_FILES} )
57+ target_link_libraries ( ${PROJECT_NAME} PRIVATE
58+ daw::parse_json
59+ daw::utf_range
60+ daw::header_libraries
61+ Boost::program_options
62+ daw::libtemp_file
63+ date::date
64+ OpenSSL::SSL
65+ OpenSSL::Crypto
66+ CURL::libcurl
67+ )
68+ target_include_directories ( ${PROJECT_NAME} PRIVATE ${HEADER_FOLDER} )
9469
95- #install( TARGETS json_to_cpp DESTINATION lib )
96- install ( TARGETS json_to_cpp DESTINATION bin )
97- #install( DIRECTORY ${HEADER_FOLDER}/ DESTINATION include/daw/json_to_cpp )
70+ install (TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
9871
0 commit comments