Difference between option_if_not_defined and option
zhufangda opened this issue · comments
ZHU Fangda commented
Hello,
I am curious that @ben-clayton define a cmake function option_if_not_defined. But I have tested and found that option_if_not_defined
and option
have the same behavior. So can you tell me why did you do that. I found you use option_if_not_defined instead of option in 2019/11/20.
function (option_if_not_defined name description default)
if(NOT DEFINED ${name})
option(${name} ${description} ${default})
endif()
endfunction()
cordialement
zhufangda
Ben Clayton commented
It prevents the CMakeCache.txt
and any related GUI from listing a whole bunch of settings that may be explicitly specified by an outer project. This removes noise, and prevents conflicting combinations of settings required by outer projects.