build-cpp / cmkr

Modern build system based on CMake and TOML.
https://cmkr.build
MIT License
439 stars 27 forks source link

[feature] msvc-static #65

Closed gmh5225 closed 1 year ago

gmh5225 commented 2 years ago

Github action: https://github.com/gmh5225/cmkr-msvc-static-testing/actions/runs/3167186905 Closes https://github.com/build-cpp/cmkr/issues/63

mrexodia commented 2 years ago

Thanks! Unfortunately I don't think this is the right way to implement things. I'll need to take a look again, but basically you need to also enable a policy because otherwise the property doesn't do anything. Right now you can achieve the same with:

[target.foo.properties]
MSVC_RUNTIME_LIBRARY = "MultiThreaded$<$<CONFIG:Debug>:Debug>"
gmh5225 commented 2 years ago

Thank you for your reply, I am thinking about how to add a policy.

gmh5225 commented 2 years ago

Artifacts: https://github.com/gmh5225/cmkr-msvc-static-testing/actions/runs/3201113555 It's ok image

mrexodia commented 1 year ago

Thanks, I think this is going in the right direction. For me the following would be a bit cleaner though:

[project]
name = "blah"
msvc-runtime = "static"

[target.dynamic-foo]
type = "executable"
msvc-runtime = "dynamic" # override the property

[target.static-foo]
type = "executable"
# has static runtime

The logic for the policy should also be a little different. It should error if you are trying to use msvc-runtime and the policy doesn't exist yet, but not emit the policy code if the msvc-runtime or MSVC_RUNTIME_LIBRARY are unset. If you don't have time to continue with this I can take over, just let me know.

gmh5225 commented 1 year ago

This looks very good :) I don't think I have that much time at the moment, but I really like this feature. thank you very much if you could take over

mrexodia commented 1 year ago

Finally for the tests to pass and documentation to generate properly, thanks for the PR!

gmh5225 commented 1 year ago

Thanks. This is fantastic and I can't wait to test it out!