marl icon indicating copy to clipboard operation
marl copied to clipboard

Difference between option_if_not_defined and option

Open zhufangda opened this issue 3 years ago • 1 comments
trafficstars

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

zhufangda avatar Jun 17 '22 05:06 zhufangda

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.

ben-clayton avatar Jun 17 '22 10:06 ben-clayton