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

Some CMake mods to LibFind and FindXYZ modules #444

Closed
wants to merge 3 commits into from

Conversation

bartgol
Copy link
Contributor

@bartgol bartgol commented Nov 24, 2021

if Find<PKG>.cmake supports multiple components, avoiding calls to
find_package_handle_standard_args inside find_packagae_component
in LibFind.cmake. The calls are instead moved inside the Find<PKG>.cmake
module (requesting to handle components).

This change removes several CMake developer warnings when finding
external packages.

Fixes #446

@jayeshkrishna
Copy link
Contributor

@bartgol :

Additionally, the implementation of `find_package_component` could be significantly shrunk by using find_path and find_library built-in capabilities.

@bartgol
Copy link
Contributor Author

bartgol commented Dec 2, 2021

"significantly" might be subjective, but the new impl sheds ~50 lines (out of ~300) off of LibFind.cmake.

@jayeshkrishna jayeshkrishna self-requested a review December 3, 2021 18:31
@bartgol
Copy link
Contributor Author

bartgol commented Dec 9, 2021

I actually just found out that cmake picks up /usr/include stuff before my NetCDF_C_PATHS. I need to put CMAKE_SYSTEM_PREFIX_PATH back in the list (at the end), and then tell find_path to exclude any default path. Otherwise, system path are always used before what's specified in PATHS.

Edit: nvm, CMAKE_SYSTEM_PREFIX_PATH is already in the list of searched paths. What I need to do is just to tell find_path to not look in any default path first.

* Tell find_path to not search in default paths (which are scanned
  before what's supplied via the PATHS argument)
* Tell find_path to also look in the include subdir of any of the
  provided paths (if present)
@bartgol
Copy link
Contributor Author

bartgol commented Feb 23, 2022

@dqwu @jayeshkrishna any interest in getting this PR move forward? If you guys don't approve/want these mods, feel free to close the PR.

@jayeshkrishna
Copy link
Contributor

@dqwu please test out the fix on all E3SM machines.

@dqwu
Copy link
Contributor

dqwu commented Feb 24, 2022

@dqwu please test out the fix on all E3SM machines.

OK, I will make sure that it will not cause any regressions.

@bartgol
Copy link
Contributor Author

bartgol commented May 17, 2023

Closing since this is stale.

@bartgol bartgol closed this May 17, 2023
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

Successfully merging this pull request may close these issues.

Newer versions of CMake generate multiple warnings when finding packages
3 participants