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

cmake presets with VS and ninja and improved merge #11666

Merged
merged 23 commits into from Jul 22, 2022

Conversation

lasote
Copy link
Contributor

@lasote lasote commented Jul 18, 2022

Changelog: Feature: The CMakePreset.json now contains toolset and architecture items when using Ninja generator and msvc compiler so the IDE (Visual Studio) can set the correct compiler (vcvars) automatically.
Docs: omit

Close #11623

@lasote lasote marked this pull request as draft July 18, 2022 12:21
@lasote lasote changed the title cmake presets with VS and ninja: AFTER https://github.com/conan-io/conan/pull/11655 cmake presets with VS and ninja: AFTER #11655 Jul 18, 2022
@lasote lasote added this to the 1.51 milestone Jul 18, 2022
@lasote lasote changed the title cmake presets with VS and ninja: AFTER #11655 cmake presets with VS and ninja Jul 19, 2022
from conans.errors import ConanException
from conans.util.files import save, load


def _add_build_preset(conanfile, multiconfig):
def _build_preset(conanfile, multiconfig):
Copy link
Contributor Author

@lasote lasote Jul 19, 2022

Choose a reason for hiding this comment

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

this is only a rename

@@ -42,7 +43,7 @@ def _configure_preset_name(conanfile, multiconfig):
return str(build_type).lower()


def _add_configure_preset(conanfile, generator, cache_variables, toolchain_file, multiconfig):
def _configure_preset(conanfile, generator, cache_variables, toolchain_file, multiconfig):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

rename only

if b["name"] == new_build_preset_name])
if not already_exist:
data["buildPresets"].append(_add_build_preset(conanfile, multiconfig))
build_preset = _build_preset(conanfile, multiconfig)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The below code was a bug, previously I only appended a preset if it didn't exist, but it might be changed, it is needed to overwrite it, so now I search the index and update.

@lasote lasote marked this pull request as ready for review July 19, 2022 13:23
@lasote lasote changed the title cmake presets with VS and ninja cmake presets with VS and ninja and improved merge Jul 19, 2022
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.

[question] CMakePresets and Visual Studio 2019 / 2022 compatibility observations
3 participants