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

Quote variables in conan_cmake_detect_vs_runtime #253

Merged

Conversation

amerry
Copy link
Contributor

@amerry amerry commented Jun 25, 2020

Account for the possibility that variables are empty, or have values which are themselves variable names, in conan_cmake_detect_vs_runtime.

There are two issues this quoting resolves. One is errors resulting from empty variables - for exampe, if CMAKE_CXX_FLAGS is empty, the string call would have failed because it would have appeared to have too few arguments - quoting the final argument fixes this.

The other is that in the context of if, a lot of operators try to resolve their argument as a variable name first (but only if it's unquoted), meaning that if(${build_type} STREQUAL "DEBUG") would have unexpected results if build_type is set to DEBUG and there is a variable DEBUG set to YES, say. Quoting the variable expansion prevents this behaviour.

Account for the possibility that variables are empty, or have values which are themselves variable names, in conan_cmake_detect_vs_runtime.

There are two issues this quoting resolves. One is errors resulting from empty variables - for exampe, if `CMAKE_CXX_FLAGS` is empty, the `string` call would have failed because it would have appeared to have too few arguments - quoting the final argument fixes this.

The other is that in the context of `if`, a lot of operators try to resolve their argument as a variable name first (but only if it's unquoted), meaning that `if(${build_type} STREQUAL "DEBUG")` would have unexpected results if `build_type` is set to `DEBUG` and there is a variable `DEBUG` set to `YES`, say. Quoting the variable expansion prevents this behaviour.
@CLAassistant
Copy link

CLAassistant commented Jun 25, 2020

CLA assistant check
All committers have signed the CLA.

@amerry amerry closed this Jun 25, 2020
@amerry amerry deleted the variable-quoting-detect_vs_runtime branch June 25, 2020 13:15
@amerry amerry restored the variable-quoting-detect_vs_runtime branch June 30, 2020 11:18
@amerry
Copy link
Contributor Author

amerry commented Jun 30, 2020

Resurrecting - there were initially some CLA issues, but they're all resolved now and I can confirm that this code is covered by the CLA.

@amerry amerry reopened this Jun 30, 2020
@czoido czoido closed this Jul 7, 2020
@czoido czoido reopened this Jul 7, 2020
@czoido czoido closed this Jul 10, 2020
@czoido czoido reopened this Jul 10, 2020
@czoido czoido added this to the 0.16 milestone Jul 10, 2020
@memsharded memsharded merged commit 56e315f into conan-io:develop Sep 1, 2020
@memsharded
Copy link
Member

Thanks for your contribution! (and sorry for the delay in reviewing it).
This will be included in next 0.16 release.

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.

5 participants