Does cmake have a mechanism to generate an error when using a undefined variable, a bit like set -u option in bash.
I have a big project composed of several CMakeLists.txt files, representing ~1500 lines, so it is quite difficult to use this construction: if(NOT DEFINED VAR_NAME)
In a ideal world, the following CMakeLists.txt whould fail.
cmake_minimum_required(VERSION 3.13)
message(STATUS "Will delete ${DIR}/${FILE}")
cmake documentation is huge, I may have missed it)As mentioned by KamilCuk, there is the --warn-uninitialized flag which you can pass when invoking CMake to configure a project. If you want it to be an error, then add -Werror=dev.
In a CMake configure preset, you can use the warnings > uninitialized member.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With