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

Support parsing cargo metadata by string(JSON ...) for cmake >= 3.19 #131

Merged
merged 7 commits into from
Feb 3, 2022

Conversation

crabtw
Copy link
Contributor

@crabtw crabtw commented Jan 23, 2022

New feature for #70

Copy link
Collaborator

@jschwe jschwe left a comment

Choose a reason for hiding this comment

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

First of all thanks for this PR! I have only skimmed the PR and will have a closer look and test it tomorrow, but I have left some comments already.

cmake/Corrosion.cmake Outdated Show resolved Hide resolved
cmake/Corrosion.cmake Outdated Show resolved Hide resolved
cmake/CorrosionGenerator.cmake Outdated Show resolved Hide resolved
cmake/CorrosionGenerator.cmake Outdated Show resolved Hide resolved
@crabtw crabtw force-pushed the json branch 2 times, most recently from 905603e to d1bb3f9 Compare January 23, 2022 10:23
@jschwe
Copy link
Collaborator

jschwe commented Jan 25, 2022

I don't think generating CMake code with file(APPEND ${out_file} is actually necessary for the new CorrosionGenerator, since it is just included later anyway.
Unless I'm missing something, I would ask you to just write the code normally there, instead of writing to a file and then including it. This was necessary for the generator written in rust, but can be avoided here.

Also, I merged #130. so it would be great if you could also add the PROFILE option to the new CorrosionGenerator.

Because function can access caller's variables, we should
set variable before appending list to avoid using wrong variable.
@crabtw
Copy link
Contributor Author

crabtw commented Jan 26, 2022

I don't think generating CMake code with file(APPEND ${out_file} is actually necessary for the new CorrosionGenerator, since it is just included later anyway. Unless I'm missing something, I would ask you to just write the code normally there, instead of writing to a file and then including it. This was necessary for the generator written in rust, but can be avoided here.

Also, I merged #130. so it would be great if you could also add the PROFILE option to the new CorrosionGenerator.

Done, thanks.

Copy link
Collaborator

@jschwe jschwe left a comment

Choose a reason for hiding this comment

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

Thanks for the changes! I've had time for a more thorough look now and I think it looks fine.
I left some more minor comments.

Also I would prefer if you would rename CORROSION_PARSE_METADATA_BY_CMAKE to CORROSION_EXPERIMENTAL_PARSER and add the option to the README.md under Usage->Options->Advanced explaining what the option does.

I tested the new generator with our project at work and it doesn't seem to break anything for us, so I'm fine with approving this MR. @ogoffart Do you want to do a second review?

cmake/CorrosionGenerator.cmake Outdated Show resolved Hide resolved
cmake/CorrosionGenerator.cmake Outdated Show resolved Hide resolved
cmake/CorrosionGenerator.cmake Show resolved Hide resolved
cmake/CorrosionGenerator.cmake Outdated Show resolved Hide resolved
@crabtw
Copy link
Contributor Author

crabtw commented Jan 27, 2022

@jschwe Done, thanks!

@jschwe jschwe merged commit 93ae1fe into corrosion-rs:master Feb 3, 2022
@housel
Copy link

housel commented Feb 5, 2022

This commit seems to break the PROPERTY CORROSION_ENVIRONMENT_VARIABLES feature for me on CMake 3.22

@jschwe
Copy link
Collaborator

jschwe commented Feb 5, 2022

Hi @housel, thanks for the report! Could you open an issue describing in a bit more detail what problem you are facing?
For me CORROSION_ENVIRONMENT_VARIABLES appear to work on CMake 3.22, and we also have the envvar test, which is passing.

@crabtw crabtw deleted the json branch February 5, 2022 12:04
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