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

cmake: Fix compiling if CFLAGS or CXXFLAGS are set #267

Closed
wants to merge 1 commit into from
Closed

cmake: Fix compiling if CFLAGS or CXXFLAGS are set #267

wants to merge 1 commit into from

Conversation

Biswa96
Copy link

@Biswa96 Biswa96 commented Apr 11, 2023

This fixes checking _mm_extract_epi64 intrinsic when CFLAGS or CXXFLAGS
are set. The -msse4.1 option is appended with existing compiler flags.
Otherwise, _mm_extract_epi64 check fails without the -msse4.1 option.
For example, the issue has been seen with the following variables in
mingw-w64 gcc 64-bit toolchain.

export CPPFLAGS="-D_FORTIFY_SOURCE=0 -D__USE_MINGW_ANSI_STDIO=1"
export CFLAGS="-mthreads -mtune=generic -O2 -pipe"
export CXXFLAGS="-mthreads -mtune=generic -O2 -pipe"
export LDFLAGS="-pipe -static-libgcc -static-libstdc++"

This fixes checking _mm_extract_epi64 intrinsic when CFLAGS or CXXFLAGS
are set. The -msse4.1 option is appended with existing compiler flags.
Otherwise, _mm_extract_epi64 check fails without the -msse4.1 option.
For example, the issue has been seen with the following variables in
mingw-w64 gcc 64-bit toolchain.

export CPPFLAGS="-D_FORTIFY_SOURCE=0 -D__USE_MINGW_ANSI_STDIO=1"
export CFLAGS="-mthreads -mtune=generic -O2 -pipe"
export CXXFLAGS="-mthreads -mtune=generic -O2 -pipe"
export LDFLAGS="-pipe -static-libgcc -static-libstdc++"
@adamjw24
Copy link
Member

Could you elaborate more? Why does add_compile_options ignore your system-wide CPPFLAGS and CFLAGS settings?

@adamjw24
Copy link
Member

Obsoleted by #268

@adamjw24 adamjw24 closed this Apr 11, 2023
@Biswa96 Biswa96 deleted the cmake branch April 11, 2023 14:44
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