Skip to content

Commit

Permalink
Merge pull request #13 from st235/fix/cmake_build_ordering
Browse files Browse the repository at this point in the history
Reorganise CMakeList: move include directories target closer to the library target and add comments
  • Loading branch information
st235 authored Jul 10, 2024
2 parents 3381bab + 6b5e7ca commit 70deba1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.26)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

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

# Library targets.

Expand All @@ -16,6 +16,9 @@ add_library(jsonc
src/json.cpp
)

target_include_directories(jsonc PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)

# Enable all possible warnings and treat them as errors.
if(MSVC)
target_compile_options(jsonc PRIVATE /W4 /WX)
else()
Expand All @@ -24,10 +27,9 @@ endif()

set_property(TARGET jsonc PROPERTY COMPILE_WARNING_AS_ERROR ON)

target_include_directories(jsonc PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)

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

Expand Down

0 comments on commit 70deba1

Please sign in to comment.