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

make FindRust gracefully fail if rustc not found #111

Merged
merged 1 commit into from
Sep 17, 2021

Conversation

trondhe
Copy link
Contributor

@trondhe trondhe commented Sep 14, 2021

Motivation for this change is to be able to reuse the FindRust module in a more general setting to see if rust exists.
With this change, it should be able to be used by any other package and afterwards check Rust_FOUND of its existence.

Earlier a missing .cargo/bin/rustc would fail with

The system cannot find the file specified
CMake Error at corrosion/cmake/FindRust.cmake:171 (get_filename_component):
  get_filename_component called with incorrect number of arguments

Now it prints a more descriptive errormessage, sets Rust_FOUND to false
and returns.
It also sets Rust_FOUND to true if a rust target is successfully created

Earlier a missing .cargo/bin/rustc would fail with

The system cannot find the file specified
CMake Error at corrosion/cmake/FindRust.cmake:171 (get_filename_component):
  get_filename_component called with incorrect number of arguments

Now it prints a more descriptive errormessage, sets Rust_FOUND to false
and returns.
It also sets Rust_FOUND to true if a rust target is successfully created
Copy link
Contributor

@ratijas ratijas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks cool. Just one little comment there.

cmake/FindRust.cmake Show resolved Hide resolved
@trondhe
Copy link
Contributor Author

trondhe commented Sep 17, 2021

@ratijas I have no write access, so I can't merge :)

@ogoffart ogoffart merged commit f679545 into corrosion-rs:master Sep 17, 2021
@ogoffart
Copy link
Collaborator

Thanks

@ratijas
Copy link
Contributor

ratijas commented Sep 17, 2021

Me neither. I'm a contributor, not collaborator — although was almost promoted to be one. I think I still I lack CMake skill a bit, but gradually getting there :)

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.

3 participants