Using current master (6a2bb0fd835977637e0f43db76121bbfd21565f6), if you configure with the following, CMake will "Error":
# gcc --version
# gcc (Ubuntu 14.2.0-4ubuntu2~24.04) 14.2.0
cmake -B build -DBUILD_KERNEL_LIB=ON -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
<snip>
Cross compiling ....................... FALSE
C++ compiler .......................... GNU 14.2.0, /usr/bin/c++
CMAKE_BUILD_TYPE ...................... RelWithDebInfo
Preprocessor defined macros ...........
C++ compiler flags .................... -O2 -g -std=c++20 -fPIC -fno-extended-identifiers -fdebug-prefix-map=/root/ci_scratch/src=. -fmacro-prefix-map=/root/ci_scratch/src=. -fstack-reuse=none -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -Wstack-protector -fstack-protector-all -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wformat -Wformat-security -Wvla -Wredundant-decls -Wdate-time -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Woverloaded-virtual -Wsuggest-override -Wimplicit-fallthrough -Wunreachable-code -Wbidi-chars=any -Wundef -Wno-unused-parameter
Linker flags .......................... -O2 -g -fstack-reuse=none -fstack-protector-all -fcf-protection=full -fstack-clash-protection -Wl,-z,relro -Wl,-z,now -Wl,-z,separate-code -fPIE -pie
NOTE: The summary above may not exactly match the final applied build flags
if any additional CMAKE_* or environment variables have been modified.
To see the exact flags applied, build with the --verbose option.
Treat compiler warnings as errors ..... OFF
Use ccache for compiling .............. ON
-- Configuring done (23.3s)
CMake Error at src/kernel/CMakeLists.txt:11 (add_library):
CMake doesn't support IPO for current compiler
-- Generating done (0.1s)
CMake Generate step failed. Build files cannot be regenerated correctly.
However you can just call cmake --build build, and compilation "works":
cmake --build build -j14 --target bitcoinkernel
[ 0%] Generating bitcoin-build-info.h
[ 0%] Built target secp256k1_precomputed
[ 0%] Built target crc32c
[ 14%] Built target bitcoin_crypto
[ 14%] Built target secp256k1
[ 42%] Built target leveldb
[ 42%] Built target generate_build_info
[ 42%] Built target bitcoin_clientversion
[100%] Built target bitcoinkernel
# file build/lib/libbitcoinkernel.a
build/lib/libbitcoinkernel.a: current ar archive
It would be good if when CMake errors during configuration, it's not actually possible to continue building, rather than silently ignoring errors.
Note that the presence of -Werror=dev when configuring, makes no difference here.
Also, the error string CMake is throwing, is also incorrect, as the compiler does support LTO.