Skip to content

Commit

Permalink
[buildsystem] Add STRICT_JSONCPP_VERSION option.
Browse files Browse the repository at this point in the history
  • Loading branch information
aarlt authored and nikola-matic committed Apr 3, 2024
1 parent d178c40 commit 780018a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ option(PEDANTIC "Enable extra warnings and pedantic build flags. Treat all warni
option(PROFILE_OPTIMIZER_STEPS "Output performance metrics for the optimiser steps." OFF)
option(USE_SYSTEM_LIBRARIES "Use system libraries" OFF)
option(ONLY_BUILD_SOLIDITY_LIBRARIES "Only build solidity libraries" OFF)
option(STRICT_JSONCPP_VERSION "Strictly check installed jsoncpp version" ON)

# Setup cccache.
include(EthCcache)
Expand All @@ -62,6 +63,10 @@ if (PROFILE_OPTIMIZER_STEPS)
add_definitions(-DPROFILE_OPTIMIZER_STEPS)
endif()

if (STRICT_JSONCPP_VERSION)
add_definitions(-DSTRICT_JSONCPP_VERSION_CHECK)
endif()

# Figure out what compiler and system are we using
include(EthCompilerSettings)

Expand Down
2 changes: 2 additions & 0 deletions libsolutil/JSON.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@
#include <map>
#include <memory>

#ifdef STRICT_JSONCPP_VERSION_CHECK
static_assert(
(JSONCPP_VERSION_MAJOR == 1) && (JSONCPP_VERSION_MINOR == 9) && (JSONCPP_VERSION_PATCH == 3),
"Unexpected jsoncpp version: " JSONCPP_VERSION_STRING ". Expecting 1.9.3."
);
#endif

namespace solidity::util
{
Expand Down

0 comments on commit 780018a

Please sign in to comment.