-
Notifications
You must be signed in to change notification settings - Fork 4
cmake: fix test and examples options #50
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -37,10 +37,35 @@ set(__ignore__ ${CMAKE_C_COMPILER}) | |||||
| # Options | ||||||
| # | ||||||
| #------------------------------------------------- | ||||||
| option(BOOST_OPENMETHOD_BUILD_TESTS "Build boost::openmethod tests even if BUILD_TESTING is OFF" OFF) | ||||||
| option(BOOST_OPENMETHOD_BUILD_EXAMPLES "Build boost::openmethod examples" ${BOOST_OPENMETHOD_IS_ROOT}) | ||||||
| option(BOOST_OPENMETHOD_MRDOCS_BUILD "Build the target for MrDocs: see mrdocs.yml" OFF) | ||||||
| option(BOOST_OPENMETHOD_WARNINGS_AS_ERRORS "Treat warnings as errors" OFF) | ||||||
|
|
||||||
| option( | ||||||
| BOOST_OPENMETHOD_BUILD_TESTS | ||||||
| "Build boost::openmethod tests even if BUILD_TESTING is OFF" | ||||||
| ${BOOST_OPENMETHOD_IS_ROOT}) | ||||||
|
|
||||||
| if (BUILD_TESTING) | ||||||
| set(BOOST_OPENMETHOD_BUILD_TESTS ON) | ||||||
| endif () | ||||||
|
|
||||||
| option( | ||||||
| BOOST_OPENMETHOD_BUILD_EXAMPLES | ||||||
| "Build boost::openmethod examples" | ||||||
| ${BOOST_OPENMETHOD_IS_ROOT}) | ||||||
| option( | ||||||
| BOOST_OPENMETHOD_MRDOCS_BUILD | ||||||
| "Build the target for MrDocs: see mrdocs.yml" | ||||||
| OFF) | ||||||
| option( | ||||||
| BOOST_OPENMETHOD_WARNINGS_AS_ERRORS | ||||||
| "Treat warnings as errors" | ||||||
| OFF) | ||||||
|
|
||||||
| if (BOOST_OPENMETHOD_BUILD_EXAMPLES AND NOT BOOST_OPENMETHOD_BUILD_TESTS) | ||||||
| message( | ||||||
| WARNING | ||||||
| "BOOST_OPENMETHOD_BUILD_EXAMPLES requires BOOST_OPENMETHOD_BUILD_TESTS. Examples will not be built.") | ||||||
| set(BOOST_OPENMETHOD_BUILD_EXAMPLES OFF) | ||||||
| endif() | ||||||
|
||||||
| endif() | |
| endif () |
Copilot
AI
Dec 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition BUILD_TESTING OR BOOST_OPENMETHOD_BUILD_TESTS is redundant. Since lines 46-48 ensure that BOOST_OPENMETHOD_BUILD_TESTS is ON whenever BUILD_TESTING is ON, checking BUILD_TESTING separately is unnecessary. Consider simplifying this to just check BOOST_OPENMETHOD_BUILD_TESTS for better maintainability.
| if (BUILD_TESTING OR BOOST_OPENMETHOD_BUILD_TESTS) | |
| if (BOOST_OPENMETHOD_BUILD_TESTS) |
Copilot
AI
Dec 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent spacing in endif statement. Line 107 uses endif() without a space, while line 213 (also newly added in this PR) uses endif () with a space. Consider standardizing on one style throughout the file for consistency.
| endif() | |
| endif () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The option description is now misleading. The option no longer allows building tests "even if BUILD_TESTING is OFF" because lines 46-48 force BOOST_OPENMETHOD_BUILD_TESTS to ON when BUILD_TESTING is ON. The description should be updated to accurately reflect that this option enables tests by default when the project is root, but is overridden to ON when BUILD_TESTING is ON.