-
Notifications
You must be signed in to change notification settings - Fork 275
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
Make CMake options consistent #421
Comments
Do you have a pointer to documentation about using subprojects with CMake and best practices for variables in that case? |
https://discourse.cmake.org/t/best-practices-for-option-naming/2039 for an example, a lot of libraries do that. And yeah you are right about |
We've come up with an idea how to support this without breaking backwards compatibility: We add a new option CMake supports that quite easily: include(CMakeDependentOption)
option(LIBZIP_AS_SUBPROJECT "Prefix option names with LIBZIP_" OFF)
cmake_dependent_option(RUN_REGRESS "Run regression tests" ON "NOT LIBZIP_AS_SUBPROJECT" ON)
cmake_dependent_option(LIBZIP_RUN_REGRESS "Run regression tests" ON "LIBZIP_AS_SUBPROJECT" ${RUN_REGRESS}) Could you please update your PR to duplicate all options as described above? |
Hi, sorry that it took me so long to respond, I had other things to do and didn't remember this. It looks like doing it like that forcefully sets RUN_REGRESS to ON (or OFF if specified as the last argument to cmake_dependent_option) if LIBZIP_AS_SUBPROJECT is specified instead of not modifying it at all so that's not ideal. |
I don't see it, but since this was only a proposal, you could fix this in your pull request :-) |
Currently libzip uses many cmake options which are not prefixed with
LIBZIP_
but some which do eg.LIBZIP_DO_INSTALL
, wouldn't it be a good idea to prefix all of the options withLIBZIP_
because it would make them consistent and reduce the chance of conflict when including libzip withadd_subdirectory
?The text was updated successfully, but these errors were encountered: