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

Extra compiler flags #916

Open
bgemmill opened this issue Jul 18, 2024 · 1 comment
Open

Extra compiler flags #916

bgemmill opened this issue Jul 18, 2024 · 1 comment

Comments

@bgemmill
Copy link

I'm trying to build mimalloc with march set to a deployment machine's architecture, and I can't seem to get the extra flags passed through to mimalloc's build process.

The usual way of configuring:
cmake "-DCMAKE_CXX_FLAGS= -march=skylake" .
runs correctly, but does not seem to produce any makefiles containing march=skylake

Near as I can tell, this is because the CMakeLists.txt file uses mi_cflags instead, and manually sets it on the target.

Is there a good way to add compile flags from the outside?

@daanx
Copy link
Collaborator

daanx commented Aug 13, 2024

Ah, I am not a CMake expert -- but it looks like target_compile_options only adds options and still respects CMAKE_CXX_FLAGS ? (see https://cmake.org/cmake/help/latest/command/target_compile_options.html#command:target_compile_options)

Maybe it is cached and you need to first remove all files in your build folder? Or maybe use the CFLAGS environment variable? or cmake "-DCMAKE_C_FLAGS= -march=skylake" since we usually build it as a C project?.

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

No branches or pull requests

2 participants