What changed, and why it matters
This commit removes a small helper function named 'die' from the project's build configuration files and replaces its three uses with CMake's standard 'message(FATAL_ERROR ...)' command. The helper added red/bold color to error messages during the build setup. There is no security relevance: the build still stops with the exact same error text when required libraries are missing.
No security action needed. This is a cosmetic/refactoring change to build configuration.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff deletes the custom CMake function ‘die(msg)’ in CMakeLists.txt, which wrapped message(FATAL_ERROR …) with ANSI color codes for non-Windows terminals. The three call sites (one in CMakeLists.txt for missing Boost, two in external/CMakeLists.txt for missing libunbound) are changed to call message(FATAL_ERROR …) directly. Behavior is functionally identical; only terminal formatting of the fatal error message changes.
Changed components
CMakeLists.txtexternal/CMakeLists.txtInspect captured patch +3 / −16
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b20f24f..3c33529 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -105,19 +105,6 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
-function (die msg)
- if (NOT WIN32)
- string(ASCII 27 Esc)
- set(ColourReset "${Esc}[m")
- set(BoldRed "${Esc}[1;31m")
- else ()
- set(ColourReset "")
- set(BoldRed "")
- endif ()
-
- message(FATAL_ERROR "${BoldRed}${msg}${ColourReset}")
-endfunction ()
-
function (add_c_flag_if_supported flag var)
# Prepending the flag with -Werror will only add the flag,
# if it doesn't result in generation of a warning of using a flag unknown to the compiler.
@@ -1025,7 +1012,7 @@ set(BOOST_MIN_VER 1.62)
find_package(Boost ${BOOST_MIN_VER} QUIET REQUIRED)
if(NOT Boost_FOUND)
- die("Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (>=${BOOST_MIN_VER}) or the equivalent")
+ message(FATAL_ERROR "Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (>=${BOOST_MIN_VER}) or the equivalent")
elseif(Boost_FOUND)
message(STATUS "Found Boost Version: ${Boost_VERSION_STRING}")
diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt
index d3c9a9d..223a22d 100644
--- a/external/CMakeLists.txt
+++ b/external/CMakeLists.txt
@@ -31,13 +31,13 @@
find_package(Unbound)
if(NOT UNBOUND_INCLUDE_DIR)
- die("Could not find libunbound")
+ message(FATAL_ERROR "Could not find libunbound")
else()
message(STATUS "Found libunbound include (unbound.h) in ${UNBOUND_INCLUDE_DIR}")
if(UNBOUND_LIBRARIES)
message(STATUS "Found libunbound library")
else()
- die("Found libunbound includes, but could not find libunbound library. Please make sure you have installed libunbound or libunbound-dev or the equivalent")
+ message(FATAL_ERROR "Found libunbound includes, but could not find libunbound library. Please make sure you have installed libunbound or libunbound-dev or the equivalent")
endif()
endif()
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.