From a4ebb373f031321fe9c3fa0261f6f26d1452364e Mon Sep 17 00:00:00 2001 From: Andres6936 Date: Sun, 26 Dec 2021 08:21:29 -0500 Subject: [PATCH 01/18] Added new rule --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 9682782..bd0365c 100644 --- a/.gitignore +++ b/.gitignore @@ -46,6 +46,7 @@ compile_commands.json *.a # eclipse project files +.idea/ .project .cproject /.settings/ @@ -55,3 +56,4 @@ compile_commands.json # temps /version +cmake-build-*/ \ No newline at end of file From fb0a546113f3dd4b656812a42bc66a13aa72e9d3 Mon Sep 17 00:00:00 2001 From: Andres6936 Date: Sun, 26 Dec 2021 08:21:40 -0500 Subject: [PATCH 02/18] Better CMake for examples --- example/CMakeLists.txt | 29 ++++----------------------- example/readFromStream/CMakeLists.txt | 3 +++ example/readFromString/CMakeLists.txt | 3 +++ example/streamWrite/CMakeLists.txt | 3 +++ example/stringWrite/CMakeLists.txt | 3 +++ 5 files changed, 16 insertions(+), 25 deletions(-) create mode 100644 example/readFromStream/CMakeLists.txt create mode 100644 example/readFromString/CMakeLists.txt create mode 100644 example/streamWrite/CMakeLists.txt create mode 100644 example/stringWrite/CMakeLists.txt diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 230d1bd..8ddade4 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1,27 +1,6 @@ #vim: et ts =4 sts = 4 sw = 4 tw = 0 -set(EXAMPLES - readFromString - readFromStream - stringWrite - streamWrite -) -add_definitions(-D_GLIBCXX_USE_CXX11_ABI) -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - add_compile_options(-Wall -Wextra) -elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - add_definitions( - -D_SCL_SECURE_NO_WARNINGS - -D_CRT_SECURE_NO_WARNINGS - -D_WIN32_WINNT=0x601 - -D_WINSOCK_DEPRECATED_NO_WARNINGS - ) -endif() - -foreach(example ${EXAMPLES}) - add_executable(${example} ${example}/${example}.cpp) - target_include_directories(${example} PUBLIC ${CMAKE_SOURCE_DIR}/include) - target_link_libraries(${example} jsoncpp_lib) -endforeach() - -add_custom_target(examples ALL DEPENDS ${EXAMPLES}) +ADD_SUBDIRECTORY(readFromStream/) +ADD_SUBDIRECTORY(readFromString/) +ADD_SUBDIRECTORY(streamWrite/) +ADD_SUBDIRECTORY(stringWrite/) \ No newline at end of file diff --git a/example/readFromStream/CMakeLists.txt b/example/readFromStream/CMakeLists.txt new file mode 100644 index 0000000..e779db6 --- /dev/null +++ b/example/readFromStream/CMakeLists.txt @@ -0,0 +1,3 @@ +add_executable(readFromStream readFromStream.cpp) +target_include_directories(readFromStream PUBLIC ${CMAKE_SOURCE_DIR}/include) +target_link_libraries(readFromStream jsoncpp_lib) \ No newline at end of file diff --git a/example/readFromString/CMakeLists.txt b/example/readFromString/CMakeLists.txt new file mode 100644 index 0000000..5c55ae2 --- /dev/null +++ b/example/readFromString/CMakeLists.txt @@ -0,0 +1,3 @@ +add_executable(readFromString readFromString.cpp) +target_include_directories(readFromString PUBLIC ${CMAKE_SOURCE_DIR}/include) +target_link_libraries(readFromString jsoncpp_lib) \ No newline at end of file diff --git a/example/streamWrite/CMakeLists.txt b/example/streamWrite/CMakeLists.txt new file mode 100644 index 0000000..8bdb061 --- /dev/null +++ b/example/streamWrite/CMakeLists.txt @@ -0,0 +1,3 @@ +add_executable(streamWrite streamWrite.cpp) +target_include_directories(streamWrite PUBLIC ${CMAKE_SOURCE_DIR}/include) +target_link_libraries(streamWrite jsoncpp_lib) \ No newline at end of file diff --git a/example/stringWrite/CMakeLists.txt b/example/stringWrite/CMakeLists.txt new file mode 100644 index 0000000..6676b02 --- /dev/null +++ b/example/stringWrite/CMakeLists.txt @@ -0,0 +1,3 @@ +add_executable(stringWrite stringWrite.cpp) +target_include_directories(stringWrite PUBLIC ${CMAKE_SOURCE_DIR}/include) +target_link_libraries(stringWrite jsoncpp_lib) \ No newline at end of file From c0cadd92953d905313f9f3188867f7b790898263 Mon Sep 17 00:00:00 2001 From: Andres6936 Date: Sun, 26 Dec 2021 09:10:34 -0500 Subject: [PATCH 03/18] Better support to CMake --- CMakeLists.txt | 27 +---- example/readFromStream/CMakeLists.txt | 5 +- example/readFromString/CMakeLists.txt | 5 +- example/streamWrite/CMakeLists.txt | 5 +- example/stringWrite/CMakeLists.txt | 5 +- include/CMakeLists.txt | 5 +- src/lib_json/CMakeLists.txt | 149 ++++++-------------------- 7 files changed, 45 insertions(+), 156 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd8bcf2..51bbe44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,6 +78,9 @@ project(jsoncpp message(STATUS "JsonCpp Version: ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") set(PROJECT_SOVERSION 25) +# Defines the project root to be used throughout all scripts. +SET(JSONCPP_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + include(${CMAKE_CURRENT_SOURCE_DIR}/include/PreventInSourceBuilds.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/include/PreventInBuildInstalls.cmake) @@ -89,9 +92,8 @@ option(JSONCPP_WITH_PKGCONFIG_SUPPORT "Generate and install .pc files" ON) option(JSONCPP_WITH_CMAKE_PACKAGE "Generate and install cmake package files" ON) option(JSONCPP_WITH_EXAMPLE "Compile JsonCpp example" OFF) option(JSONCPP_STATIC_WINDOWS_RUNTIME "Use static (MT/MTd) Windows runtime" OFF) -option(BUILD_SHARED_LIBS "Build jsoncpp_lib as a shared library." ON) -option(BUILD_STATIC_LIBS "Build jsoncpp_lib as a static library." ON) -option(BUILD_OBJECT_LIBS "Build jsoncpp_lib as a object library." ON) + +option(JSONCPP_BUILD_SHARED_LIBS "Build jsoncpp_lib as a shared library." OFF) # Adhere to GNU filesystem layout conventions include(GNUInstallDirs) @@ -179,22 +181,6 @@ if(JSONCPP_WITH_PKGCONFIG_SUPPORT) DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") endif() -if(JSONCPP_WITH_CMAKE_PACKAGE) - include(CMakePackageConfigHelpers) - install(EXPORT jsoncpp - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jsoncpp - FILE jsoncpp-targets.cmake) - configure_package_config_file(jsoncppConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfig.cmake - INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jsoncpp) - - write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfigVersion.cmake" - VERSION ${PROJECT_VERSION} - COMPATIBILITY SameMajorVersion) - install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfigVersion.cmake ${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfig.cmake - ${CMAKE_CURRENT_SOURCE_DIR}/jsoncpp-namespaced-targets.cmake - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jsoncpp) -endif() if(JSONCPP_WITH_TESTS) enable_testing() @@ -204,9 +190,6 @@ endif() # Build the different applications add_subdirectory(src) -#install the includes -add_subdirectory(include) - #install the example if(JSONCPP_WITH_EXAMPLE) add_subdirectory(example) diff --git a/example/readFromStream/CMakeLists.txt b/example/readFromStream/CMakeLists.txt index e779db6..e947dcd 100644 --- a/example/readFromStream/CMakeLists.txt +++ b/example/readFromStream/CMakeLists.txt @@ -1,3 +1,2 @@ -add_executable(readFromStream readFromStream.cpp) -target_include_directories(readFromStream PUBLIC ${CMAKE_SOURCE_DIR}/include) -target_link_libraries(readFromStream jsoncpp_lib) \ No newline at end of file +ADD_EXECUTABLE(readFromStream readFromStream.cpp) +TARGET_LINK_LIBRARIES(readFromStream PRIVATE jsoncpp::framework) \ No newline at end of file diff --git a/example/readFromString/CMakeLists.txt b/example/readFromString/CMakeLists.txt index 5c55ae2..d076651 100644 --- a/example/readFromString/CMakeLists.txt +++ b/example/readFromString/CMakeLists.txt @@ -1,3 +1,2 @@ -add_executable(readFromString readFromString.cpp) -target_include_directories(readFromString PUBLIC ${CMAKE_SOURCE_DIR}/include) -target_link_libraries(readFromString jsoncpp_lib) \ No newline at end of file +ADD_EXECUTABLE(readFromString readFromString.cpp) +TARGET_LINK_LIBRARIES(readFromString PRIVATE jsoncpp::framework) \ No newline at end of file diff --git a/example/streamWrite/CMakeLists.txt b/example/streamWrite/CMakeLists.txt index 8bdb061..f5f9e63 100644 --- a/example/streamWrite/CMakeLists.txt +++ b/example/streamWrite/CMakeLists.txt @@ -1,3 +1,2 @@ -add_executable(streamWrite streamWrite.cpp) -target_include_directories(streamWrite PUBLIC ${CMAKE_SOURCE_DIR}/include) -target_link_libraries(streamWrite jsoncpp_lib) \ No newline at end of file +ADD_EXECUTABLE(streamWrite streamWrite.cpp) +TARGET_LINK_LIBRARIES(streamWrite PRIVATE jsoncpp::framework) \ No newline at end of file diff --git a/example/stringWrite/CMakeLists.txt b/example/stringWrite/CMakeLists.txt index 6676b02..28c3ce7 100644 --- a/example/stringWrite/CMakeLists.txt +++ b/example/stringWrite/CMakeLists.txt @@ -1,3 +1,2 @@ -add_executable(stringWrite stringWrite.cpp) -target_include_directories(stringWrite PUBLIC ${CMAKE_SOURCE_DIR}/include) -target_link_libraries(stringWrite jsoncpp_lib) \ No newline at end of file +ADD_EXECUTABLE(stringWrite stringWrite.cpp) +TARGET_LINK_LIBRARIES(stringWrite PRIVATE jsoncpp::framework) \ No newline at end of file diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index dc40d95..139597f 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -1,5 +1,2 @@ -file(GLOB INCLUDE_FILES "json/*.h") -install(FILES - ${INCLUDE_FILES} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/json) + diff --git a/src/lib_json/CMakeLists.txt b/src/lib_json/CMakeLists.txt index 3cf66eb..d24d273 100644 --- a/src/lib_json/CMakeLists.txt +++ b/src/lib_json/CMakeLists.txt @@ -25,41 +25,11 @@ if(NOT (HAVE_CLOCALE AND HAVE_LCONV_SIZE AND HAVE_DECIMAL_POINT AND HAVE_LOCALEC endif() endif() -set(JSONCPP_INCLUDE_DIR ../../include) - -set(PUBLIC_HEADERS - ${JSONCPP_INCLUDE_DIR}/json/config.h - ${JSONCPP_INCLUDE_DIR}/json/forwards.h - ${JSONCPP_INCLUDE_DIR}/json/json_features.h - ${JSONCPP_INCLUDE_DIR}/json/value.h - ${JSONCPP_INCLUDE_DIR}/json/reader.h - ${JSONCPP_INCLUDE_DIR}/json/version.h - ${JSONCPP_INCLUDE_DIR}/json/writer.h - ${JSONCPP_INCLUDE_DIR}/json/assertions.h -) - -source_group("Public API" FILES ${PUBLIC_HEADERS}) - -set(JSONCPP_SOURCES - json_tool.h - json_reader.cpp - json_valueiterator.inl - json_value.cpp - json_writer.cpp -) - -# Install instructions for this target -if(JSONCPP_WITH_CMAKE_PACKAGE) - set(INSTALL_EXPORT EXPORT jsoncpp) -else() - set(INSTALL_EXPORT) -endif() # Specify compiler features required when compiling a given target. # See https://cmake.org/cmake/help/v3.1/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html#prop_gbl:CMAKE_CXX_KNOWN_FEATURES # for complete list of features available list(APPEND REQUIRED_FEATURES - cxx_std_11 # Compiler mode is aware of C++ 11. #MSVC 1900 cxx_alignas # Alignment control alignas, as defined in N2341. #MSVC 1900 cxx_alignof # Alignment control alignof, as defined in N2341. #MSVC 1900 cxx_attributes # Generic attributes, as defined in N2761. @@ -106,103 +76,46 @@ list(APPEND REQUIRED_FEATURES ) -if(BUILD_SHARED_LIBS) - if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0) - add_compile_definitions(JSON_DLL_BUILD) - else() - add_definitions(-DJSON_DLL_BUILD) - endif() +ADD_LIBRARY(jsoncpp.framework.object OBJECT + json_tool.h + json_reader.cpp + json_valueiterator.inl + json_value.cpp + json_writer.cpp + ) - set(SHARED_LIB ${PROJECT_NAME}_lib) - add_library(${SHARED_LIB} SHARED ${PUBLIC_HEADERS} ${JSONCPP_SOURCES}) - set_target_properties(${SHARED_LIB} PROPERTIES - OUTPUT_NAME jsoncpp - VERSION ${PROJECT_VERSION} - SOVERSION ${PROJECT_SOVERSION} - POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} - ) +SET_TARGET_PROPERTIES(jsoncpp.framework.object PROPERTIES CXX_STANDARD 11) +SET_TARGET_PROPERTIES(jsoncpp.framework.object PROPERTIES VERSION ${PROJECT_VERSION}) +SET_TARGET_PROPERTIES(jsoncpp.framework.object PROPERTIES SOVERSION ${PROJECT_SOVERSION}) - # Set library's runtime search path on OSX - if(APPLE) - set_target_properties(${SHARED_LIB} PROPERTIES INSTALL_RPATH "@loader_path/.") - endif() +TARGET_COMPILE_FEATURES(jsoncpp.framework.object PUBLIC ${REQUIRED_FEATURES}) +TARGET_INCLUDE_DIRECTORIES(jsoncpp.framework.object PUBLIC $) - target_compile_features(${SHARED_LIB} PUBLIC ${REQUIRED_FEATURES}) +# Set library's runtime search path on OSX +IF (APPLE) + SET_TARGET_PROPERTIES(jsoncpp.framework.object PROPERTIES INSTALL_RPATH "@loader_path/.") +ENDIF () - target_include_directories(${SHARED_LIB} PUBLIC - $ - $ - $ - ) - list(APPEND CMAKE_TARGETS ${SHARED_LIB}) -endif() +IF (JSONCPP_BUILD_SHARED_LIBS) -if(BUILD_STATIC_LIBS) - set(STATIC_LIB ${PROJECT_NAME}_static) - add_library(${STATIC_LIB} STATIC ${PUBLIC_HEADERS} ${JSONCPP_SOURCES}) + # CMake link shared library on Windows + # Ref: https://stackoverflow.com/a/41618677 + SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) - # avoid name clashes on windows as the shared import lib is also named jsoncpp.lib - if(NOT DEFINED STATIC_SUFFIX AND BUILD_SHARED_LIBS) - if (MSVC) - set(STATIC_SUFFIX "_static") - else() - set(STATIC_SUFFIX "") - endif() - endif() + ADD_LIBRARY(jsoncpp.framework SHARED $) + TARGET_COMPILE_DEFINITIONS(jsoncpp.framework PUBLIC JSON_DLL_BUILD) - set_target_properties(${STATIC_LIB} PROPERTIES - OUTPUT_NAME jsoncpp${STATIC_SUFFIX} - VERSION ${PROJECT_VERSION} - ) +ELSE () - # Set library's runtime search path on OSX - if(APPLE) - set_target_properties(${STATIC_LIB} PROPERTIES INSTALL_RPATH "@loader_path/.") - endif() + ADD_LIBRARY(jsoncpp.framework STATIC $) - target_compile_features(${STATIC_LIB} PUBLIC ${REQUIRED_FEATURES}) +ENDIF () - target_include_directories(${STATIC_LIB} PUBLIC - $ - $ - $ - ) - - list(APPEND CMAKE_TARGETS ${STATIC_LIB}) -endif() - -if(BUILD_OBJECT_LIBS) - set(OBJECT_LIB ${PROJECT_NAME}_object) - add_library(${OBJECT_LIB} OBJECT ${PUBLIC_HEADERS} ${JSONCPP_SOURCES}) - - set_target_properties(${OBJECT_LIB} PROPERTIES - OUTPUT_NAME jsoncpp - VERSION ${PROJECT_VERSION} - SOVERSION ${PROJECT_SOVERSION} - POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} - ) - - # Set library's runtime search path on OSX - if(APPLE) - set_target_properties(${OBJECT_LIB} PROPERTIES INSTALL_RPATH "@loader_path/.") - endif() - - target_compile_features(${OBJECT_LIB} PUBLIC ${REQUIRED_FEATURES}) - - target_include_directories(${OBJECT_LIB} PUBLIC - $ - $ - $ - ) - - list(APPEND CMAKE_TARGETS ${OBJECT_LIB}) -endif() - -install(TARGETS ${CMAKE_TARGETS} ${INSTALL_EXPORT} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - OBJECTS DESTINATION ${CMAKE_INSTALL_LIBDIR} -) +ADD_LIBRARY(jsoncpp::framework ALIAS jsoncpp.framework) +SET_TARGET_PROPERTIES(jsoncpp.framework PROPERTIES CXX_STANDARD 11) +SET_TARGET_PROPERTIES(jsoncpp.framework PROPERTIES VERSION ${PROJECT_VERSION}) +SET_TARGET_PROPERTIES(jsoncpp.framework PROPERTIES SOVERSION ${PROJECT_SOVERSION}) +TARGET_COMPILE_FEATURES(jsoncpp.framework PUBLIC ${REQUIRED_FEATURES}) +TARGET_INCLUDE_DIRECTORIES(jsoncpp.framework PUBLIC $) \ No newline at end of file From 0cc72eb9f1de3b9968653818db608da16f5e2659 Mon Sep 17 00:00:00 2001 From: Andres6936 Date: Sun, 26 Dec 2021 09:12:41 -0500 Subject: [PATCH 04/18] Removed targets for Apple --- src/lib_json/CMakeLists.txt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/lib_json/CMakeLists.txt b/src/lib_json/CMakeLists.txt index d24d273..1805d87 100644 --- a/src/lib_json/CMakeLists.txt +++ b/src/lib_json/CMakeLists.txt @@ -91,11 +91,6 @@ SET_TARGET_PROPERTIES(jsoncpp.framework.object PROPERTIES SOVERSION ${PROJECT_SO TARGET_COMPILE_FEATURES(jsoncpp.framework.object PUBLIC ${REQUIRED_FEATURES}) TARGET_INCLUDE_DIRECTORIES(jsoncpp.framework.object PUBLIC $) -# Set library's runtime search path on OSX -IF (APPLE) - SET_TARGET_PROPERTIES(jsoncpp.framework.object PROPERTIES INSTALL_RPATH "@loader_path/.") -ENDIF () - IF (JSONCPP_BUILD_SHARED_LIBS) From 575313c1645512af0858fab869fa9b45b10d8c01 Mon Sep 17 00:00:00 2001 From: Andres6936 Date: Sun, 26 Dec 2021 09:14:22 -0500 Subject: [PATCH 05/18] Removed unnecessary files from library definition --- src/lib_json/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/lib_json/CMakeLists.txt b/src/lib_json/CMakeLists.txt index 1805d87..4aff853 100644 --- a/src/lib_json/CMakeLists.txt +++ b/src/lib_json/CMakeLists.txt @@ -77,9 +77,7 @@ list(APPEND REQUIRED_FEATURES ADD_LIBRARY(jsoncpp.framework.object OBJECT - json_tool.h json_reader.cpp - json_valueiterator.inl json_value.cpp json_writer.cpp ) From 952c15c1c16936d29aa22ce8a43074d6e4487203 Mon Sep 17 00:00:00 2001 From: Andres6936 Date: Sun, 26 Dec 2021 09:16:38 -0500 Subject: [PATCH 06/18] Removed problematic targets --- CMakeLists.txt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51bbe44..f098e7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,11 +98,6 @@ option(JSONCPP_BUILD_SHARED_LIBS "Build jsoncpp_lib as a shared library." OFF) # Adhere to GNU filesystem layout conventions include(GNUInstallDirs) -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" CACHE PATH "Archive output dir.") -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" CACHE PATH "Library output dir.") -set(CMAKE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" CACHE PATH "PDB (MSVC debug symbol)output dir.") -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" CACHE PATH "Executable/dll output dir.") - set(JSONCPP_USE_SECURE_MEMORY "0" CACHE STRING "-D...=1 to use memory-wiping allocator for STL") configure_file("${PROJECT_SOURCE_DIR}/version.in" From 30e4023a2edba1a1873668f270e6d2040a799c25 Mon Sep 17 00:00:00 2001 From: Andres6936 Date: Sun, 26 Dec 2021 09:21:47 -0500 Subject: [PATCH 07/18] Better Quality Test --- src/jsontestrunner/CMakeLists.txt | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/src/jsontestrunner/CMakeLists.txt b/src/jsontestrunner/CMakeLists.txt index 1fc71ea..ca18773 100644 --- a/src/jsontestrunner/CMakeLists.txt +++ b/src/jsontestrunner/CMakeLists.txt @@ -1,28 +1,11 @@ -if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0) - # The new Python3 module is much more robust than the previous PythonInterp - find_package(Python3 COMPONENTS Interpreter) - # Set variables for backwards compatibility with cmake < 3.12.0 - set(PYTHONINTERP_FOUND ${Python3_Interpreter_FOUND}) - set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) -else() - set(Python_ADDITIONAL_VERSIONS 3.8) - find_package(PythonInterp 3) -endif() +# The new Python3 module is much more robust than the previous PythonInterp +FIND_PACKAGE(Python3 COMPONENTS Interpreter) +# Set variables for backwards compatibility with cmake < 3.12.0 +SET(PYTHONINTERP_FOUND ${Python3_Interpreter_FOUND}) +SET(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) -add_executable(jsontestrunner_exe - main.cpp -) - -if(BUILD_SHARED_LIBS) - if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0) - add_compile_definitions( JSON_DLL ) - else() - add_definitions(-DJSON_DLL) - endif() - target_link_libraries(jsontestrunner_exe jsoncpp_lib) -else() - target_link_libraries(jsontestrunner_exe jsoncpp_static) -endif() +ADD_EXECUTABLE(jsontestrunner_exe main.cpp) +TARGET_LINK_LIBRARIES(jsontestrunner_exe PRIVATE jsoncpp::framework) set_target_properties(jsontestrunner_exe PROPERTIES OUTPUT_NAME jsontestrunner_exe) From 59f4b2c10d7cb5036fed734a1ab779db16af6a82 Mon Sep 17 00:00:00 2001 From: Andres6936 Date: Sun, 26 Dec 2021 09:33:32 -0500 Subject: [PATCH 08/18] Better Quality Test --- src/jsontestrunner/CMakeLists.txt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/jsontestrunner/CMakeLists.txt b/src/jsontestrunner/CMakeLists.txt index ca18773..adaa95f 100644 --- a/src/jsontestrunner/CMakeLists.txt +++ b/src/jsontestrunner/CMakeLists.txt @@ -11,24 +11,23 @@ set_target_properties(jsontestrunner_exe PROPERTIES OUTPUT_NAME jsontestrunner_e if(PYTHONINTERP_FOUND) # Run end to end parser/writer tests - set(TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../test) - set(RUNJSONTESTS_PATH ${TEST_DIR}/runjsontests.py) + set(RUNJSONTESTS_PATH ${JSONCPP_ROOT_DIR}/test/runjsontests.py) # Run unit tests in post-build # (default cmake workflow hides away the test result into a file, resulting in poor dev workflow?!?) add_custom_target(jsoncpp_readerwriter_tests - "${PYTHON_EXECUTABLE}" -B "${RUNJSONTESTS_PATH}" $ "${TEST_DIR}/data" + "${PYTHON_EXECUTABLE}" -B "${RUNJSONTESTS_PATH}" $ "${JSONCPP_ROOT_DIR}/test/data" DEPENDS jsontestrunner_exe jsoncpp_test ) add_custom_target(jsoncpp_check DEPENDS jsoncpp_readerwriter_tests) ## Create tests for dashboard submission, allows easy review of CI results https://my.cdash.org/index.php?project=jsoncpp add_test(NAME jsoncpp_readerwriter - COMMAND "${PYTHON_EXECUTABLE}" -B "${RUNJSONTESTS_PATH}" $ "${TEST_DIR}/data" - WORKING_DIRECTORY "${TEST_DIR}/data" + COMMAND "${PYTHON_EXECUTABLE}" -B "${RUNJSONTESTS_PATH}" $ "${JSONCPP_ROOT_DIR}/test/data" + WORKING_DIRECTORY "${JSONCPP_ROOT_DIR}/test/data" ) add_test(NAME jsoncpp_readerwriter_json_checker - COMMAND "${PYTHON_EXECUTABLE}" -B "${RUNJSONTESTS_PATH}" --with-json-checker $ "${TEST_DIR}/data" - WORKING_DIRECTORY "${TEST_DIR}/data" + COMMAND "${PYTHON_EXECUTABLE}" -B "${RUNJSONTESTS_PATH}" --with-json-checker $ "${JSONCPP_ROOT_DIR}/test/data" + WORKING_DIRECTORY "${JSONCPP_ROOT_DIR}/test/data" ) endif() From 6b0719a6675fd5b996712e7f3611ccbc3a716599 Mon Sep 17 00:00:00 2001 From: Andres6936 Date: Sun, 26 Dec 2021 09:34:27 -0500 Subject: [PATCH 09/18] Better Quality Test --- src/test_lib_json/CMakeLists.txt | 46 +++++++++++++------------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/src/test_lib_json/CMakeLists.txt b/src/test_lib_json/CMakeLists.txt index 1c3fce9..060208c 100644 --- a/src/test_lib_json/CMakeLists.txt +++ b/src/test_lib_json/CMakeLists.txt @@ -1,39 +1,29 @@ # vim: et ts=4 sts=4 sw=4 tw=0 -add_executable(jsoncpp_test - jsontest.cpp - jsontest.h - fuzz.cpp - fuzz.h - main.cpp -) +ADD_EXECUTABLE(jsoncpp_test + jsontest.cpp + jsontest.h + fuzz.cpp + fuzz.h + main.cpp + ) - -if(BUILD_SHARED_LIBS) - if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0) - add_compile_definitions( JSON_DLL ) - else() - add_definitions( -DJSON_DLL ) - endif() - target_link_libraries(jsoncpp_test jsoncpp_lib) -else() - target_link_libraries(jsoncpp_test jsoncpp_static) -endif() +TARGET_LINK_LIBRARIES(jsoncpp_test PRIVATE jsoncpp::framework) # another way to solve issue #90 #set_target_properties(jsoncpp_test PROPERTIES COMPILE_FLAGS -ffloat-store) ## Create tests for dashboard submission, allows easy review of CI results https://my.cdash.org/index.php?project=jsoncpp -add_test(NAME jsoncpp_test - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -) -set_target_properties(jsoncpp_test PROPERTIES OUTPUT_NAME jsoncpp_test) +ADD_TEST(NAME jsoncpp_test + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ + ) +SET_TARGET_PROPERTIES(jsoncpp_test PROPERTIES OUTPUT_NAME jsoncpp_test) # Run unit tests in post-build # (default cmake workflow hides away the test result into a file, resulting in poor dev workflow?!?) -if(JSONCPP_WITH_POST_BUILD_UNITTEST) - add_custom_command(TARGET jsoncpp_test - POST_BUILD - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ - ) -endif() +IF (JSONCPP_WITH_POST_BUILD_UNITTEST) + ADD_CUSTOM_COMMAND(TARGET jsoncpp_test + POST_BUILD + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ + ) +ENDIF () From 398da6b9793ca274ede2c598bcc55bd837923fb4 Mon Sep 17 00:00:00 2001 From: Andres6936 Date: Sun, 26 Dec 2021 09:38:26 -0500 Subject: [PATCH 10/18] Removed global directives --- CMakeLists.txt | 9 --------- 1 file changed, 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f098e7f..3e74680 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,12 +40,6 @@ foreach(pold "") # Currently Empty endif() endforeach() -# Build the library with C++11 standard support, independent from other including -# software which may use a different CXX_STANDARD or CMAKE_CXX_STANDARD. -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_EXTENSIONS OFF) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - # Ensure that CMAKE_BUILD_TYPE has a value specified for single configuration generators. if(NOT DEFINED CMAKE_BUILD_TYPE AND NOT DEFINED CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE Release CACHE STRING @@ -117,9 +111,6 @@ macro(use_compilation_warning_as_error) endif() endmacro() -# Include our configuration header -include_directories(${jsoncpp_SOURCE_DIR}/include) - if(MSVC) # Only enabled in debug because some old versions of VS STL generate # unreachable code warning when compiled in release configuration. From cda19ed07bf9f1f70bb1b0ca4bae4425767d5934 Mon Sep 17 00:00:00 2001 From: Andres6936 Date: Sun, 26 Dec 2021 09:40:09 -0500 Subject: [PATCH 11/18] Added documentation --- src/lib_json/CMakeLists.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/lib_json/CMakeLists.txt b/src/lib_json/CMakeLists.txt index 4aff853..0fe8b16 100644 --- a/src/lib_json/CMakeLists.txt +++ b/src/lib_json/CMakeLists.txt @@ -75,6 +75,14 @@ list(APPEND REQUIRED_FEATURES cxx_variadic_templates # Variadic templates, as defined in N2242. ) +# The OBJECT's can be used to compile the sources in the list given to add_library +# to object files, but then neither archiving them into a static library nor +# linking them into a shared object. The use of object libraries is +# particularly useful if one needs to create both static and shared libraries +# in one go. + +# Property: OBJECT + ADD_LIBRARY(jsoncpp.framework.object OBJECT json_reader.cpp @@ -96,7 +104,14 @@ IF (JSONCPP_BUILD_SHARED_LIBS) # Ref: https://stackoverflow.com/a/41618677 SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) + # The POSITION_INDEPENDENT_CODE property determines whether position independent executables or + # shared libraries will be created. This property is True by default for SHARED and MODULE library + # targets and False otherwise. + + # Property: SHARED, POSITION_INDEPENDENT_CODE ADD_LIBRARY(jsoncpp.framework SHARED $) + + # Needed for legacy code TARGET_COMPILE_DEFINITIONS(jsoncpp.framework PUBLIC JSON_DLL_BUILD) ELSE () @@ -111,4 +126,6 @@ SET_TARGET_PROPERTIES(jsoncpp.framework PROPERTIES VERSION ${PROJECT_VERSION}) SET_TARGET_PROPERTIES(jsoncpp.framework PROPERTIES SOVERSION ${PROJECT_SOVERSION}) TARGET_COMPILE_FEATURES(jsoncpp.framework PUBLIC ${REQUIRED_FEATURES}) +# It is necessary to repeat these instructions again, in case of not doing it, the executables +# will be unable to locate the Headers needed to perform the linking TARGET_INCLUDE_DIRECTORIES(jsoncpp.framework PUBLIC $) \ No newline at end of file From 3e90985c360bbda0800d563d6735029a7f1ff7f1 Mon Sep 17 00:00:00 2001 From: Andres6936 Date: Sun, 26 Dec 2021 11:42:39 -0500 Subject: [PATCH 12/18] Format to lower-case --- CMakeLists.txt | 2 +- example/CMakeLists.txt | 8 +++--- example/readFromStream/CMakeLists.txt | 4 +-- example/readFromString/CMakeLists.txt | 4 +-- example/streamWrite/CMakeLists.txt | 4 +-- example/stringWrite/CMakeLists.txt | 4 +-- src/lib_json/CMakeLists.txt | 38 +++++++++++++-------------- 7 files changed, 32 insertions(+), 32 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e74680..c6b228d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,7 +73,7 @@ message(STATUS "JsonCpp Version: ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINO set(PROJECT_SOVERSION 25) # Defines the project root to be used throughout all scripts. -SET(JSONCPP_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +set(JSONCPP_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) include(${CMAKE_CURRENT_SOURCE_DIR}/include/PreventInSourceBuilds.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/include/PreventInBuildInstalls.cmake) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 8ddade4..f6ebb58 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1,6 +1,6 @@ #vim: et ts =4 sts = 4 sw = 4 tw = 0 -ADD_SUBDIRECTORY(readFromStream/) -ADD_SUBDIRECTORY(readFromString/) -ADD_SUBDIRECTORY(streamWrite/) -ADD_SUBDIRECTORY(stringWrite/) \ No newline at end of file +add_subdirectory(readFromStream/) +add_subdirectory(readFromString/) +add_subdirectory(streamWrite/) +add_subdirectory(stringWrite/) \ No newline at end of file diff --git a/example/readFromStream/CMakeLists.txt b/example/readFromStream/CMakeLists.txt index e947dcd..77524d2 100644 --- a/example/readFromStream/CMakeLists.txt +++ b/example/readFromStream/CMakeLists.txt @@ -1,2 +1,2 @@ -ADD_EXECUTABLE(readFromStream readFromStream.cpp) -TARGET_LINK_LIBRARIES(readFromStream PRIVATE jsoncpp::framework) \ No newline at end of file +add_executable(readFromStream readFromStream.cpp) +target_link_libraries(readFromStream PRIVATE jsoncpp::framework) \ No newline at end of file diff --git a/example/readFromString/CMakeLists.txt b/example/readFromString/CMakeLists.txt index d076651..b8352e6 100644 --- a/example/readFromString/CMakeLists.txt +++ b/example/readFromString/CMakeLists.txt @@ -1,2 +1,2 @@ -ADD_EXECUTABLE(readFromString readFromString.cpp) -TARGET_LINK_LIBRARIES(readFromString PRIVATE jsoncpp::framework) \ No newline at end of file +add_executable(readFromString readFromString.cpp) +target_link_libraries(readFromString PRIVATE jsoncpp::framework) \ No newline at end of file diff --git a/example/streamWrite/CMakeLists.txt b/example/streamWrite/CMakeLists.txt index f5f9e63..e82d179 100644 --- a/example/streamWrite/CMakeLists.txt +++ b/example/streamWrite/CMakeLists.txt @@ -1,2 +1,2 @@ -ADD_EXECUTABLE(streamWrite streamWrite.cpp) -TARGET_LINK_LIBRARIES(streamWrite PRIVATE jsoncpp::framework) \ No newline at end of file +add_executable(streamWrite streamWrite.cpp) +target_link_libraries(streamWrite PRIVATE jsoncpp::framework) \ No newline at end of file diff --git a/example/stringWrite/CMakeLists.txt b/example/stringWrite/CMakeLists.txt index 28c3ce7..a1f80cc 100644 --- a/example/stringWrite/CMakeLists.txt +++ b/example/stringWrite/CMakeLists.txt @@ -1,2 +1,2 @@ -ADD_EXECUTABLE(stringWrite stringWrite.cpp) -TARGET_LINK_LIBRARIES(stringWrite PRIVATE jsoncpp::framework) \ No newline at end of file +add_executable(stringWrite stringWrite.cpp) +target_link_libraries(stringWrite PRIVATE jsoncpp::framework) \ No newline at end of file diff --git a/src/lib_json/CMakeLists.txt b/src/lib_json/CMakeLists.txt index 0fe8b16..930853f 100644 --- a/src/lib_json/CMakeLists.txt +++ b/src/lib_json/CMakeLists.txt @@ -84,48 +84,48 @@ list(APPEND REQUIRED_FEATURES # Property: OBJECT -ADD_LIBRARY(jsoncpp.framework.object OBJECT +add_library(jsoncpp.framework.object OBJECT json_reader.cpp json_value.cpp json_writer.cpp ) -SET_TARGET_PROPERTIES(jsoncpp.framework.object PROPERTIES CXX_STANDARD 11) -SET_TARGET_PROPERTIES(jsoncpp.framework.object PROPERTIES VERSION ${PROJECT_VERSION}) -SET_TARGET_PROPERTIES(jsoncpp.framework.object PROPERTIES SOVERSION ${PROJECT_SOVERSION}) +set_target_properties(jsoncpp.framework.object PROPERTIES CXX_STANDARD 11) +set_target_properties(jsoncpp.framework.object PROPERTIES VERSION ${PROJECT_VERSION}) +set_target_properties(jsoncpp.framework.object PROPERTIES SOVERSION ${PROJECT_SOVERSION}) -TARGET_COMPILE_FEATURES(jsoncpp.framework.object PUBLIC ${REQUIRED_FEATURES}) -TARGET_INCLUDE_DIRECTORIES(jsoncpp.framework.object PUBLIC $) +target_compile_features(jsoncpp.framework.object PUBLIC ${REQUIRED_FEATURES}) +target_include_directories(jsoncpp.framework.object PUBLIC $) -IF (JSONCPP_BUILD_SHARED_LIBS) +if (JSONCPP_BUILD_SHARED_LIBS) # CMake link shared library on Windows # Ref: https://stackoverflow.com/a/41618677 - SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) # The POSITION_INDEPENDENT_CODE property determines whether position independent executables or # shared libraries will be created. This property is True by default for SHARED and MODULE library # targets and False otherwise. # Property: SHARED, POSITION_INDEPENDENT_CODE - ADD_LIBRARY(jsoncpp.framework SHARED $) + add_library(jsoncpp.framework SHARED $) # Needed for legacy code - TARGET_COMPILE_DEFINITIONS(jsoncpp.framework PUBLIC JSON_DLL_BUILD) + target_compile_definitions(jsoncpp.framework PUBLIC JSON_DLL_BUILD) -ELSE () +else () - ADD_LIBRARY(jsoncpp.framework STATIC $) + add_library(jsoncpp.framework STATIC $) -ENDIF () +endif () -ADD_LIBRARY(jsoncpp::framework ALIAS jsoncpp.framework) -SET_TARGET_PROPERTIES(jsoncpp.framework PROPERTIES CXX_STANDARD 11) -SET_TARGET_PROPERTIES(jsoncpp.framework PROPERTIES VERSION ${PROJECT_VERSION}) -SET_TARGET_PROPERTIES(jsoncpp.framework PROPERTIES SOVERSION ${PROJECT_SOVERSION}) +add_library(jsoncpp::framework ALIAS jsoncpp.framework) +set_target_properties(jsoncpp.framework PROPERTIES CXX_STANDARD 11) +set_target_properties(jsoncpp.framework PROPERTIES VERSION ${PROJECT_VERSION}) +set_target_properties(jsoncpp.framework PROPERTIES SOVERSION ${PROJECT_SOVERSION}) -TARGET_COMPILE_FEATURES(jsoncpp.framework PUBLIC ${REQUIRED_FEATURES}) +target_compile_features(jsoncpp.framework PUBLIC ${REQUIRED_FEATURES}) # It is necessary to repeat these instructions again, in case of not doing it, the executables # will be unable to locate the Headers needed to perform the linking -TARGET_INCLUDE_DIRECTORIES(jsoncpp.framework PUBLIC $) \ No newline at end of file +target_include_directories(jsoncpp.framework PUBLIC $) \ No newline at end of file From a7ba7f7fd52fc62889b4042be011d2a7cfc1cd32 Mon Sep 17 00:00:00 2001 From: Andres6936 Date: Sun, 26 Dec 2021 11:44:19 -0500 Subject: [PATCH 13/18] Format to lower-case --- src/test_lib_json/CMakeLists.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/test_lib_json/CMakeLists.txt b/src/test_lib_json/CMakeLists.txt index 060208c..c2636f6 100644 --- a/src/test_lib_json/CMakeLists.txt +++ b/src/test_lib_json/CMakeLists.txt @@ -1,6 +1,6 @@ # vim: et ts=4 sts=4 sw=4 tw=0 -ADD_EXECUTABLE(jsoncpp_test +add_executable(jsoncpp_test jsontest.cpp jsontest.h fuzz.cpp @@ -8,22 +8,22 @@ ADD_EXECUTABLE(jsoncpp_test main.cpp ) -TARGET_LINK_LIBRARIES(jsoncpp_test PRIVATE jsoncpp::framework) +target_link_libraries(jsoncpp_test PRIVATE jsoncpp::framework) # another way to solve issue #90 #set_target_properties(jsoncpp_test PROPERTIES COMPILE_FLAGS -ffloat-store) ## Create tests for dashboard submission, allows easy review of CI results https://my.cdash.org/index.php?project=jsoncpp -ADD_TEST(NAME jsoncpp_test +add_test(NAME jsoncpp_test COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ) -SET_TARGET_PROPERTIES(jsoncpp_test PROPERTIES OUTPUT_NAME jsoncpp_test) +set_target_properties(jsoncpp_test PROPERTIES OUTPUT_NAME jsoncpp_test) # Run unit tests in post-build # (default cmake workflow hides away the test result into a file, resulting in poor dev workflow?!?) -IF (JSONCPP_WITH_POST_BUILD_UNITTEST) - ADD_CUSTOM_COMMAND(TARGET jsoncpp_test +if (JSONCPP_WITH_POST_BUILD_UNITTEST) + add_custom_command(TARGET jsoncpp_test POST_BUILD COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ) -ENDIF () +endif () From 25f876287e284a2d2f452a80b871e5a0dac37c92 Mon Sep 17 00:00:00 2001 From: Andres6936 Date: Sun, 26 Dec 2021 11:45:34 -0500 Subject: [PATCH 14/18] Format to lower-case --- src/test_lib_json/CMakeLists.txt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/test_lib_json/CMakeLists.txt b/src/test_lib_json/CMakeLists.txt index c2636f6..eefc98a 100644 --- a/src/test_lib_json/CMakeLists.txt +++ b/src/test_lib_json/CMakeLists.txt @@ -5,8 +5,7 @@ add_executable(jsoncpp_test jsontest.h fuzz.cpp fuzz.h - main.cpp - ) + main.cpp) target_link_libraries(jsoncpp_test PRIVATE jsoncpp::framework) @@ -15,8 +14,7 @@ target_link_libraries(jsoncpp_test PRIVATE jsoncpp::framework) ## Create tests for dashboard submission, allows easy review of CI results https://my.cdash.org/index.php?project=jsoncpp add_test(NAME jsoncpp_test - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ - ) + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_target_properties(jsoncpp_test PROPERTIES OUTPUT_NAME jsoncpp_test) # Run unit tests in post-build @@ -24,6 +22,5 @@ set_target_properties(jsoncpp_test PROPERTIES OUTPUT_NAME jsoncpp_test) if (JSONCPP_WITH_POST_BUILD_UNITTEST) add_custom_command(TARGET jsoncpp_test POST_BUILD - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ - ) + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) endif () From 6d1b01479cc9cc9a68d5a285bac152cd06a3cf1f Mon Sep 17 00:00:00 2001 From: Andres6936 Date: Sun, 26 Dec 2021 11:49:31 -0500 Subject: [PATCH 15/18] Added missing rule --- src/lib_json/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib_json/CMakeLists.txt b/src/lib_json/CMakeLists.txt index 930853f..bbb23f5 100644 --- a/src/lib_json/CMakeLists.txt +++ b/src/lib_json/CMakeLists.txt @@ -113,6 +113,7 @@ if (JSONCPP_BUILD_SHARED_LIBS) # Needed for legacy code target_compile_definitions(jsoncpp.framework PUBLIC JSON_DLL_BUILD) + target_compile_definitions(jsoncpp.framework PUBLIC JSON_DLL) else () From f54f580454a3a2d5b7868d8a45ef0b5f16401079 Mon Sep 17 00:00:00 2001 From: Andres6936 Date: Sun, 26 Dec 2021 11:53:48 -0500 Subject: [PATCH 16/18] Added extra properties --- src/lib_json/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib_json/CMakeLists.txt b/src/lib_json/CMakeLists.txt index bbb23f5..59daf9d 100644 --- a/src/lib_json/CMakeLists.txt +++ b/src/lib_json/CMakeLists.txt @@ -91,6 +91,8 @@ add_library(jsoncpp.framework.object OBJECT ) set_target_properties(jsoncpp.framework.object PROPERTIES CXX_STANDARD 11) +set_target_properties(jsoncpp.framework.object PROPERTIES CXX_EXTENSIONS OFF) +set_target_properties(jsoncpp.framework.object PROPERTIES CXX_STANDARD_REQUIRED ON) set_target_properties(jsoncpp.framework.object PROPERTIES VERSION ${PROJECT_VERSION}) set_target_properties(jsoncpp.framework.object PROPERTIES SOVERSION ${PROJECT_SOVERSION}) @@ -123,6 +125,8 @@ endif () add_library(jsoncpp::framework ALIAS jsoncpp.framework) set_target_properties(jsoncpp.framework PROPERTIES CXX_STANDARD 11) +set_target_properties(jsoncpp.framework PROPERTIES CXX_EXTENSIONS OFF) +set_target_properties(jsoncpp.framework PROPERTIES CXX_STANDARD_REQUIRED ON) set_target_properties(jsoncpp.framework PROPERTIES VERSION ${PROJECT_VERSION}) set_target_properties(jsoncpp.framework PROPERTIES SOVERSION ${PROJECT_SOVERSION}) From 4c79fda236165597a3c7738d4a2b02c9ca3867e7 Mon Sep 17 00:00:00 2001 From: Andres6936 Date: Sun, 26 Dec 2021 11:57:31 -0500 Subject: [PATCH 17/18] Lower-case format --- src/jsontestrunner/CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/jsontestrunner/CMakeLists.txt b/src/jsontestrunner/CMakeLists.txt index adaa95f..3c8a18b 100644 --- a/src/jsontestrunner/CMakeLists.txt +++ b/src/jsontestrunner/CMakeLists.txt @@ -1,11 +1,11 @@ # The new Python3 module is much more robust than the previous PythonInterp -FIND_PACKAGE(Python3 COMPONENTS Interpreter) +find_package(Python3 COMPONENTS Interpreter) # Set variables for backwards compatibility with cmake < 3.12.0 -SET(PYTHONINTERP_FOUND ${Python3_Interpreter_FOUND}) -SET(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) +set(PYTHONINTERP_FOUND ${Python3_Interpreter_FOUND}) +set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) -ADD_EXECUTABLE(jsontestrunner_exe main.cpp) -TARGET_LINK_LIBRARIES(jsontestrunner_exe PRIVATE jsoncpp::framework) +add_executable(jsontestrunner_exe main.cpp) +target_link_libraries(jsontestrunner_exe PRIVATE jsoncpp::framework) set_target_properties(jsontestrunner_exe PROPERTIES OUTPUT_NAME jsontestrunner_exe) From bd5bc9a5acdb93b07192de796b936d0689572475 Mon Sep 17 00:00:00 2001 From: Andres6936 Date: Sat, 15 Jan 2022 08:41:18 -0500 Subject: [PATCH 18/18] Added full rules --- .gitignore | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 116 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index bd0365c..626b66c 100644 --- a/.gitignore +++ b/.gitignore @@ -46,7 +46,6 @@ compile_commands.json *.a # eclipse project files -.idea/ .project .cproject /.settings/ @@ -56,4 +55,119 @@ compile_commands.json # temps /version -cmake-build-*/ \ No newline at end of file +cmake-build-*/ + +# Created by https://www.toptal.com/developers/gitignore/api/intellij +# Edit at https://www.toptal.com/developers/gitignore?templates=intellij + +### Intellij ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf +.idea/** + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +# *.iml +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin +# https://plugins.jetbrains.com/plugin/7973-sonarlint +.idea/**/sonarlint/ + +# SonarQube Plugin +# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin +.idea/**/sonarIssues.xml + +# Markdown Navigator plugin +# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced +.idea/**/markdown-navigator.xml +.idea/**/markdown-navigator-enh.xml +.idea/**/markdown-navigator/ + +# Cache file creation bug +# See https://youtrack.jetbrains.com/issue/JBR-2257 +.idea/$CACHE_FILE$ + +# CodeStream plugin +# https://plugins.jetbrains.com/plugin/12206-codestream +.idea/codestream.xml + +# End of https://www.toptal.com/developers/gitignore/api/intellij \ No newline at end of file