11#*******************************************************************************
2- #* (c) 2020 Zondax GmbH
2+ #* (c) 2018 - 2024 Zondax AGs
33#*
44#* Licensed under the Apache License, Version 2.0 (the "License");
55#* you may not use this file except in compliance with the License.
1313#* See the License for the specific language governing permissions and
1414#* limitations under the License.
1515#********************************************************************************
16- cmake_minimum_required (VERSION 3.0 )
16+ cmake_minimum_required (VERSION 3.28 )
17+ include ("cmake/HunterGate.cmake" )
18+ HunterGate (
19+ URL "https://github.com/cpp-pm/hunter/archive/v0.25.5.tar.gz"
20+ SHA1 "a20151e4c0740ee7d0f9994476856d813cdead29"
21+ LOCAL
22+ )
23+
24+ if (CMAKE_GENERATOR MATCHES "Ninja" )
25+ message (FATAL_ERROR "This project does not support the Ninja generator. "
26+ "Please use Unix Makefiles or another supported generator. "
27+ "This error is typical in CLion. In this case, switch to generator Unix Makefiles." )
28+ endif ()
29+
30+ ########################################################
31+
1732project (ledger-kusama VERSION 0.0.0)
18- enable_testing ()
1933
34+ set (CMAKE_CXX_STANDARD 17)
2035cmake_policy (SET CMP0025 NEW )
21- set (CMAKE_CXX_STANDARD 11)
36+ cmake_policy (SET CMP0144 NEW )
37+
38+ set (HUNTER_STATUS_DEBUG ON )
39+ set (HUNTER_TLS_VERIFY OFF )
40+
41+ enable_testing ()
2242
2343option (ENABLE_FUZZING "Build with fuzzing instrumentation and build fuzz targets" OFF )
2444option (ENABLE_COVERAGE "Build with source code coverage instrumentation" OFF )
@@ -31,6 +51,15 @@ string(APPEND CMAKE_LINKER_FLAGS " -fno-omit-frame-pointer -g")
3151add_definitions (-DAPP_STANDARD )
3252add_definitions (-DSUBSTRATE_PARSER_FULL )
3353
54+ hunter_add_package (fmt )
55+ find_package (fmt CONFIG REQUIRED )
56+
57+ hunter_add_package (jsoncpp )
58+ find_package (jsoncpp CONFIG REQUIRED )
59+
60+ hunter_add_package (GTest )
61+ find_package (GTest CONFIG REQUIRED )
62+
3463if (ENABLE_FUZZING)
3564 add_definitions (-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION=1 )
3665 SET (ENABLE_SANITIZERS ON CACHE BOOL "Sanitizer automatically enabled" FORCE )
@@ -71,9 +100,6 @@ if(ENABLE_SANITIZERS)
71100 string (APPEND CMAKE_LINKER_FLAGS " -fsanitize=address,undefined -fsanitize-recover=address,undefined" )
72101endif ()
73102
74- include (cmake/conan/CMakeLists.txt )
75- add_subdirectory (cmake/gtest )
76-
77103set (RETRIEVE_MAJOR_CMD
78104 "cat ${CMAKE_CURRENT_SOURCE_DIR} /app/Makefile.version | grep APPVERSION_M | cut -b 14- | tr -d '\n '"
79105)
@@ -140,20 +166,18 @@ add_executable(unittests ${TESTS_SRC})
140166target_include_directories (unittests PRIVATE
141167 ${gtest_SOURCE_DIR} /include
142168 ${gmock_SOURCE_DIR} /include
143- ${CONAN_INCLUDE_DIRS_FMT}
144- ${CONAN_INCLUDE_DIRS_JSONCPP}
145169 ${CMAKE_CURRENT_SOURCE_DIR} /app/src
146170 ${CMAKE_CURRENT_SOURCE_DIR} /app/src/lib
147171 )
148172
149173target_link_libraries (unittests PRIVATE
150- gtest_main
151174 app_lib
152- CONAN_PKG::fmt
153- CONAN_PKG::jsoncpp )
175+ GTest::gtest_main
176+ fmt::fmt
177+ JsonCpp::JsonCpp )
154178
155179add_compile_definitions (TESTVECTORS_DIR= "${CMAKE_CURRENT_SOURCE_DIR} /tests/" )
156- add_test (unittests ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} / unittests )
180+ add_test (NAME unittests COMMAND unittests )
157181set_tests_properties (unittests PROPERTIES WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} /tests )
158182
159183##############################################################
0 commit comments