-
Notifications
You must be signed in to change notification settings - Fork 455
Do not elide find_package() if MONGO_USE_CCACHE is set #1031
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
Conversation
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.
I discovered one other quirk of note. Also, I'm guessing you probably meant "find_program()
" in the commit/PR message 🙂.
message (STATUS "Compiling with CCache enabled. Disable by setting MONGO_USE_CCACHE to OFF") | ||
option (MONGO_USE_CCACHE "Use CCache when compiling" ON) | ||
endif () | ||
endif (CCACHE_EXECUTABLE AND NOT DEFINED MONGO_USE_CCACHE) |
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.
Is there a reason you're repeating the condition in the endif()
call?
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.
Just to not lose track of the corresponding if ()
given the size of the block, a la #endif // COND
or } // namespace <name>
. I can remove if you think it is undesirable/unnecessary.
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.
It only tends to be a code smell as it is a very very old pattern that is disrecommended anymore in favor of just using prose-like comments for the purpose, but I don't feel strongly about it here.
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.
I prefer endif (<cond>)
over endif () # cond
since CMake actually detects and enforces <cond>
matches, which is a maintainability bonus imo as it prevents (or at least tries to prevent) the possibility of prose-like comments becoming outdated/detached from the matching if ()
.
CMake Warning (dev) in example/CMakeLists.txt:
A logical block opening on the line
CMakeLists.txt:10 (if)
closes on the line
CMakeLists.txt:12 (endif)
with mis-matching arguments.
Admittedly it gets confusing if there are any elseif() / else ()
blocks involved, so I avoid using it in such cases, but I still prefer using them if it's simple (but large) if() / endif()
blocks. I may reconsider this stance after further thought. 🤔
Fixed it in the commit message in the description, but not in the commit message header itself. 🤦 |
This reverts commit 237bcf8.
Description
Fix overzealous elison of call to
find_package()
find_program()
introduced in #1029 whenMONGO_USE_CCACHE
is set.CCACHE_EXECUTABLE
still needs to be found and set whenMONGO_USE_CCACHE
is manually set by the user on initial configuration, not just post-configuration.