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

Fix CMake.test() target for Ninja Multi-Config #11594

Merged

Conversation

Naufragous
Copy link
Contributor

@Naufragous Naufragous commented Jul 8, 2022

Changelog: Bugfix: Use correct build target in CMake.test() for the Ninja Multi-Config generator.
Docs: omit
Fixes #11405

@CLAassistant
Copy link

CLAassistant commented Jul 8, 2022

CLA assistant check
All committers have signed the CLA.

@Naufragous
Copy link
Contributor Author

I used the test_run_tests test case from conans/test/unittests/client/build/cmake_test.py as basis for this new test. Unfortunately there seem to be not that many tests for the new CMake tool. Please advise if something is off.

Copy link
Member

@memsharded memsharded 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 contributing this fix.

write_cmake_presets(conanfile, "toolchain", generator, {})
cmake = CMake(conanfile)
cmake.test()
assert "'--target' '%s'" % target in conanfile.command
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
assert "'--target' '%s'" % target in conanfile.command
if platform.system() == "Windows":
assert "--target %s" % target in conanfile.command
else:
assert "'--target' '%s'" % target in conanfile.command

There is a small difference atm in the command in Windows, the args are not quoted.

Copy link
Member

Choose a reason for hiding this comment

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

cc/ @lasote This is one of the things related to #11553, that seems a bit weird to me, that the commands quoting is different in different systems.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the suggestion. I added the platform import and made the search pattern conditional on the platform.

@memsharded memsharded added this to the 1.51 milestone Jul 8, 2022
@memsharded memsharded merged commit 5ae2626 into conan-io:develop Jul 9, 2022
@memsharded
Copy link
Member

Merged, this will be released in 1.51.
Thanks again for your contribution!

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.

[bug] cmake.test() cannot execute
3 participants