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

Allow not forcibly setting CMAKE_C_FLAGS and CMAKE_CXX_FLAGS #198

Open
anderslanglands opened this issue Dec 3, 2023 · 4 comments
Open

Comments

@anderslanglands
Copy link

I hit the same issue as #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?

@Zagitta
Copy link

Zagitta commented Dec 28, 2023

I'm facing this exact issue here as well: alianse777/darknet-rust#10

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

@Blonteractor
Copy link

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.

@Chiichen
Copy link

Chiichen commented Sep 6, 2024

The same on me LibVNC/libvncserver#628! I'm not an expert on cmake. I can not find out the reson that these builds failed on. I think adding a flag like force_no_default_flags to pass no_default_setting=true to crate cc works. I will give it a try

@Chiichen
Copy link

Chiichen commented Sep 8, 2024

I've opend a PR(#219 ) for this. You can try this in https://github.com/Chiichen/cmake-rs/tree/feat-force-no-default-flags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants