cmake-rs icon indicating copy to clipboard operation
cmake-rs copied to clipboard

Allow not forcibly setting CMAKE_C_FLAGS and CMAKE_CXX_FLAGS

Open anderslanglands opened this issue 1 year ago • 4 comments

I hit the same issue as https://github.com/rust-lang/cmake-rs/issues/133

The reason is that even if no cflags or cxxflags are specified in the Config, it will still forcibly set those in the cfg, even if no_default_flags is forced to true (in that case CMAKE_C(XX)_FLAGS is just set to empty).

This causes some libraries to fail to build on windows because of the missing /EHsc flag that CMake sets by default, but is apparently not in the list that Config pulls from cc.

I would expect that if I don't supply any flags to Config, then I should get the exact same result as calling cmake in the terminal, which is not what happens currently. Is there a way we can change this behaviour?

anderslanglands avatar Dec 03 '23 06:12 anderslanglands

I'm facing this exact issue here as well: https://github.com/alianse777/darknet-rust/issues/10

There really needs to be a way to instruct cmake-rs to not set those flags

Zagitta avatar Dec 28 '23 12:12 Zagitta

I am facing the same issue, the build command works when CMAKE_C_FLAGS and CMAKE_CXX_FLAGS are not passed in, but this lib always passes them as something and even when they are empty it doesnt work.

Blonteractor avatar Jan 22 '24 10:01 Blonteractor