Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change PUBLIC build declaration to INTERFACE, increate version to 0.9.3 #16

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,35 @@ cmake_minimum_required(VERSION 3.26)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

project(JSONC VERSION 0.9.2 DESCRIPTION "JSONC is a lightweight implementation of JSON Data Interchange Standard for C++ programming language.")
project(JSONC VERSION 0.9.3 DESCRIPTION "JSONC is a lightweight implementation of JSON Data Interchange Standard for C++ programming language.")

# Library targets.

add_library(jsonc
src/json_parser.h
src/json_parser.cpp
src/json_token_reader.h
src/json_minifier.cpp
src/json_beautifier.cpp
src/json.cpp
)

target_include_directories(jsonc PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
add_library(jsonc INTERFACE)

# Enable all possible warnings and treat them as errors.
if(MSVC)
target_compile_options(jsonc PRIVATE /W4)
target_compile_options(jsonc INTERFACE /W4 /WX)
else()
target_compile_options(jsonc PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(jsonc INTERFACE -Wall -Wextra -Wpedantic -Werror)
endif()

set_property(TARGET jsonc PROPERTY COMPILE_WARNING_AS_ERROR ON)

# Enable assertions statements in the codebase.
if (ASSERT)
message("Enabling assertions in the code.")
add_compile_definitions(ASSERT=${ASSERT})
endif()

target_sources(jsonc INTERFACE
src/json_parser.h
src/json_parser.cpp
src/json_token_reader.h
src/json_minifier.cpp
src/json_beautifier.cpp
src/json.cpp
)
target_include_directories(jsonc INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)

# Test targets.

include(FetchContent)
Expand Down Expand Up @@ -72,9 +71,9 @@ add_executable(jsonc_tests
tests/integration/json_minifier_tests.cpp
)

target_link_libraries(jsonc_tests jsonc)
target_link_libraries(jsonc_tests PRIVATE jsonc)
# GMock is required to use EXPECT_THAT.
target_link_libraries(jsonc_tests GTest::gtest_main GTest::gmock_main)
target_link_libraries(jsonc_tests PRIVATE GTest::gtest_main GTest::gmock_main)
target_include_directories(jsonc_tests PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src)

include(GoogleTest)
Expand Down