Skip to content

Commit

Permalink
[build][cmake] Fix cmake with custom assembler
Browse files Browse the repository at this point in the history
Fixes cmake build when the C compiler isn't used as the assembler.
We need to explicitly set the flag `-x assembler-with-cpp` to enable
the preprocessor.

Fixes facebook#3193.
  • Loading branch information
terrelln committed Dec 20, 2022
1 parent 6a90c0f commit 8aab5ca
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions build/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ if( CMAKE_MAJOR_VERSION LESS 3 )
set(PROJECT_VERSION_PATCH ${zstd_VERSION_PATCH})
set(PROJECT_VERSION "${zstd_VERSION_MAJOR}.${zstd_VERSION_MINOR}.${zstd_VERSION_PATCH}")
enable_language(C) # Main library is in C
enable_language(ASM) # And ASM
enable_language(CXX) # Testing contributed code also utilizes CXX
else()
project(zstd
VERSION "${zstd_VERSION_MAJOR}.${zstd_VERSION_MINOR}.${zstd_VERSION_PATCH}"
LANGUAGES C # Main library is in C
ASM # And ASM
CXX # Testing contributed code also utilizes CXX
)
endif()
Expand All @@ -67,6 +69,7 @@ include(GNUInstallDirs)
#-----------------------------------------------------------------------------
include(AddZstdCompilationFlags)
ADD_ZSTD_COMPILATION_FLAGS()
SET(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -x assembler-with-cpp")

# Always hide XXHash symbols
add_definitions(-DXXH_NAMESPACE=ZSTD_)
Expand Down

0 comments on commit 8aab5ca

Please sign in to comment.