Skip to content

Allow passing in custom RUSTFLAGS#835

Merged
val-ms merged 1 commit intoCisco-Talos:mainfrom
opoplawski:rustflags
Mar 22, 2023
Merged

Allow passing in custom RUSTFLAGS#835
val-ms merged 1 commit intoCisco-Talos:mainfrom
opoplawski:rustflags

Conversation

@opoplawski
Copy link
Contributor

Also, according to https://cmake.org/cmake/help/latest/command/add_custom_command.html the ARGS option is ignored.

@val-ms
Copy link
Contributor

val-ms commented Mar 9, 2023

Most of this makes sense to me, with the string(APPEND RUSTFLAGS " -g") and string(STRIP "${RUSTFLAGS}" RUSTFLAGS).
Removing ARGS also makes sense, after looking at the docs to see that the minimum cmake version we require says it is optional/ignored.

I am a little confused about one part of this change. Why do you want to remove the quotes around ${RUSTFLAGS}? It seems like that might break things if you have more than one flag.

@opoplawski
Copy link
Contributor Author

The quotes caused problems. It seems like cmake automatically quotes the arguments.

Copy link
Contributor

@val-ms val-ms left a comment

Choose a reason for hiding this comment

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

The quotes caused problems. It seems like cmake automatically quotes the arguments.

Very interesting. I didn't expect it to work this way, but I did some manual testing using options -D RUSTFLAGS="-g -v" and it seems good.

We may also consider adding some documentation to the top of this file explaining that you can set RUSTFLAGS cmake variable before using this module. But I don't feel strongly about it. I ran this through our automated tests a couple weeks ago and that looked good. May as well merge now.

Thanks for the PR @opoplawski

@val-ms val-ms merged commit 8147218 into Cisco-Talos:main Mar 22, 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.

2 participants