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

Add Proper (Recursive) CMAKE_C_FLAGS Handling #484

Merged
merged 1 commit into from
Nov 26, 2022

Conversation

adfernandes
Copy link
Contributor

So I had a funny problem with the standard cmake build of Bear generating executables with illegal instructions for my (admittedly) aged computer.

My base setup was Ubuntu 18.04 with the Ubuntu gcc-11 toolchain installed.

Wonder of wonders, my ancient AMD Barcelona CPU does not have the required instructions for the default codegen options of GCC 11.

I attempted to fix this by specifying CMAKE_C_FLAGS=-march=native and CMAKE_CXX_FLAGS=-march=native, but kept getting illegal instructions being generated.

So examining the CMakeLists.txt files, I found that although CMAKE_CXX_FLAGS was being respected and passed to the subprojects, CMAKE_C_FLAGS was not.

The patch below is required to properly pass build options to the subprojects.

Happily, now everything works and I can avoid buying a new computer for just a little while longer!

@rizsotto rizsotto merged commit d2e495d into rizsotto:master Nov 26, 2022
@adfernandes adfernandes deleted the andrew/cflags branch November 27, 2022 23:17
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

Successfully merging this pull request may close these issues.

2 participants