1
0
Fork 0
forked from lthn/blockchain

Refactor config variable checks into macro

Replaces repetitive individual variable checks with a macro to streamline and simplify the process of verifying required configuration variables in CMake.
This commit is contained in:
Snider 2025-09-25 18:28:10 +01:00
parent 06e7780df5
commit e3910d8a59

View file

@ -1,57 +1,30 @@
if (NOT DEFINED currency_display_decimal_point)
message(FATAL_ERROR "currency_display_decimal_point not set")
endif()
if (NOT DEFINED coin)
message(FATAL_ERROR "coin not set")
endif()
if (NOT DEFINED base_reward_dust_threshold)
message(FATAL_ERROR "base_reward_dust_threshold not set")
endif()
if (NOT DEFINED default_dust_threshold)
message(FATAL_ERROR "default_dust_threshold not set")
endif()
if (NOT DEFINED tx_default_fee)
message(FATAL_ERROR "tx_default_fee not set")
endif()
if (NOT DEFINED tx_minimum_fee)
message(FATAL_ERROR "tx_minimum_fee not set")
endif()
if (NOT DEFINED difficulty_pow_starter)
message(FATAL_ERROR "difficulty_pow_starter not set")
endif()
if (NOT DEFINED difficulty_pos_target)
message(FATAL_ERROR "difficulty_pos_target not set")
endif()
if (NOT DEFINED difficulty_pow_target)
message(FATAL_ERROR "difficulty_pow_target not set")
endif()
if (NOT DEFINED difficulty_window)
message(FATAL_ERROR "difficulty_window not set")
endif()
if (NOT DEFINED difficulty_lag)
message(FATAL_ERROR "difficulty_lag not set")
endif()
if (NOT DEFINED difficulty_cut)
message(FATAL_ERROR "difficulty_cut not set")
endif()
if (NOT DEFINED p2p_default_port)
message(FATAL_ERROR "p2p_default_port not set")
endif()
if (NOT DEFINED rpc_default_port)
message(FATAL_ERROR "rpc_default_port not set")
endif()
if (NOT DEFINED stratum_default_port)
message(FATAL_ERROR "stratum_default_port not set")
endif()
if (NOT DEFINED p2p_maintainers_pub_key)
message(FATAL_ERROR "p2p_maintainers_pub_key not set")
endif()
if (NOT DEFINED currency_name_abr)
message(FATAL_ERROR "currency_name_abr not set")
endif()
if (NOT DEFINED currency_name_base)
message(FATAL_ERROR "currency_name_base not set")
endif()
if (NOT DEFINED currency_name_short_base)
message(FATAL_ERROR "currency_name_short_base not set")
endif()
macro(check_defined_vars)
foreach(var ${ARGN})
if(NOT DEFINED ${var})
message(FATAL_ERROR "${var} not set")
endif()
endforeach()
endmacro()
check_defined_vars(
currency_display_decimal_point
coin
base_reward_dust_threshold
default_dust_threshold
tx_default_fee
tx_minimum_fee
difficulty_pow_starter
difficulty_pos_target
difficulty_pow_target
difficulty_window
difficulty_lag
difficulty_cut
p2p_default_port
rpc_default_port
stratum_default_port
p2p_maintainers_pub_key
currency_name_abr
currency_name_base
currency_name_short_base
)