Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difference between option_if_not_defined and option #223

Closed
zhufangda opened this issue Jun 17, 2022 · 1 comment
Closed

Difference between option_if_not_defined and option #223

zhufangda opened this issue Jun 17, 2022 · 1 comment

Comments

@zhufangda
Copy link

zhufangda commented Jun 17, 2022

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
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants