1
1
#*******************************************************************************
2
- #* (c) 2020 Zondax GmbH
2
+ #* (c) 2018 - 2024 Zondax AGs
3
3
#*
4
4
#* Licensed under the Apache License, Version 2.0 (the "License");
5
5
#* you may not use this file except in compliance with the License.
13
13
#* See the License for the specific language governing permissions and
14
14
#* limitations under the License.
15
15
#********************************************************************************
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
+
17
32
project (ledger-kusama VERSION 0.0.0)
18
- enable_testing ()
19
33
34
+ set (CMAKE_CXX_STANDARD 17)
20
35
cmake_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 ()
22
42
23
43
option (ENABLE_FUZZING "Build with fuzzing instrumentation and build fuzz targets" OFF )
24
44
option (ENABLE_COVERAGE "Build with source code coverage instrumentation" OFF )
@@ -31,6 +51,15 @@ string(APPEND CMAKE_LINKER_FLAGS " -fno-omit-frame-pointer -g")
31
51
add_definitions (-DAPP_STANDARD)
32
52
add_definitions (-DSUBSTRATE_PARSER_FULL)
33
53
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
+
34
63
if (ENABLE_FUZZING)
35
64
add_definitions (-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION=1)
36
65
SET (ENABLE_SANITIZERS ON CACHE BOOL "Sanitizer automatically enabled" FORCE)
@@ -71,9 +100,6 @@ if(ENABLE_SANITIZERS)
71
100
string (APPEND CMAKE_LINKER_FLAGS " -fsanitize=address,undefined -fsanitize-recover=address,undefined" )
72
101
endif ()
73
102
74
- include (cmake/conan/CMakeLists.txt)
75
- add_subdirectory (cmake/gtest)
76
-
77
103
set (RETRIEVE_MAJOR_CMD
78
104
"cat ${CMAKE_CURRENT_SOURCE_DIR} /app/Makefile.version | grep APPVERSION_M | cut -b 14- | tr -d '\n '"
79
105
)
@@ -140,20 +166,18 @@ add_executable(unittests ${TESTS_SRC})
140
166
target_include_directories (unittests PRIVATE
141
167
${gtest_SOURCE_DIR} /include
142
168
${gmock_SOURCE_DIR} /include
143
- ${CONAN_INCLUDE_DIRS_FMT}
144
- ${CONAN_INCLUDE_DIRS_JSONCPP}
145
169
${CMAKE_CURRENT_SOURCE_DIR} /app/src
146
170
${CMAKE_CURRENT_SOURCE_DIR} /app/src/lib
147
171
)
148
172
149
173
target_link_libraries (unittests PRIVATE
150
- gtest_main
151
174
app_lib
152
- CONAN_PKG::fmt
153
- CONAN_PKG::jsoncpp)
175
+ GTest::gtest_main
176
+ fmt::fmt
177
+ JsonCpp::JsonCpp)
154
178
155
179
add_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)
157
181
set_tests_properties (unittests PROPERTIES WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} /tests)
158
182
159
183
##############################################################
0 commit comments