rust-lang / cmake-rs

Rust build dependency for running cmake
https://docs.rs/cmake
Apache License 2.0
310 stars 123 forks source link

Find CMake bundled with MSVC #142

Open knopp opened 2 years ago

knopp commented 2 years ago

Hi,

it would be quite useful if the crate could determine location of CMake binary bundled with MSVC. The usual location is

${msvcPath}\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin.

shuffle2 commented 2 years ago

It would be nice, but what is your intent? If it's to build with cmake/<ninja/vs>/msvc, it would seem the standard way to bring cmake into PATH is to run vcvars script beforehand. In that case, I think it would be appropriate to add some way for the cmake or cc crate to find and execute the vcvars script as needed, instead. But I haven't seen other people doing that... :/

fwiw i've solved it like this: https://github.com/unicorn-engine/unicorn/blob/3fcfdcedd83284ce71d751fcec8b8d422a00ee87/bindings/rust/build.rs#L9 (but, it should be in a crate, I agree). Maybe some of the underlying msvc/VS-specific stuff (like cc crate's setup_config and/or vswhere wrapper) should be their own crates..