-
Notifications
You must be signed in to change notification settings - Fork 950
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
Feature: add support for setting CMAKE_GENERATOR_INSTANCE #16229
Closed
perseoGI
wants to merge
3
commits into
conan-io:develop2
from
perseoGI:16222-feature-cmake_generator_instance
Closed
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1414,3 +1414,32 @@ def build(self): | |
}) | ||
client.run("export tool") | ||
client.run("create consumer -pr:h host -pr:b build --build=missing") | ||
|
||
|
||
def test_toolchain_generator_instance(): | ||
windows_profile = textwrap.dedent(""" | ||
[settings] | ||
os=Windows | ||
arch=x86_64 | ||
[conf] | ||
tools.cmake.cmaketoolchain:generator_instance="C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/" | ||
""") | ||
|
||
client = TestClient(path_with_spaces=False) | ||
client.save({"conanfile.txt": "[generators]\nCMakeToolchain", | ||
"windows": windows_profile}) | ||
|
||
# Test passing path from profile | ||
client.run("install . --profile:build=windows --profile:host=windows") | ||
toolchain = client.load("conan_toolchain.cmake") | ||
assert 'set(CMAKE_GENERATOR_INSTANCE "C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/")' in toolchain | ||
|
||
# Test input from command line passing path between doble quotes | ||
client.run('install . --profile:build=windows --profile:host=windows -c tools.cmake.cmaketoolchain:generator_instance="C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/"') | ||
toolchain = client.load("conan_toolchain.cmake") | ||
assert "set(CMAKE_GENERATOR_INSTANCE \"C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/\")" in toolchain | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use same assert in the 3 cases, not one with single quote without escaping, and the other asserts with double quotes and escaping. I'll copy the first one in the 3 cases. |
||
|
||
# Test input from command line passing path between simple quotes | ||
client.run('install . --profile:build=windows --profile:host=windows -c tools.cmake.cmaketoolchain:generator_instance=\'C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/\'') | ||
toolchain = client.load("conan_toolchain.cmake") | ||
assert "set(CMAKE_GENERATOR_INSTANCE \"C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/\")" in toolchain |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the quoting management would be better addressed more homogeneusly with other confs/options, and not in isolation. If we allow quotes in profiles for this conf, but not for others, it can be confusing and error prone (other confs adding quotes will fail).
I suggest:
Then we can consider about possible alternatives to make this integrated with
conf.get()
, so other confs can use it too, but separately to this PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okey, strips removed, we will consider later if we want to support quotations in conan profiles