Skip to content

Commit 92de130

Browse files
ThomasDevoogdtedsiper
authored andcommitted
build: only compile simdutf if there is CXX support
Commit 3b04755 "build: lib: Bundle simdutf amalgamation v5.5.0", added support for simdutf, and enforces CXX support if FLB_UNICODE_ENCODER is selected. Which is the default case, fix that now. Signed-off-by: Thomas Devoogdt <[email protected]>
1 parent 2fe47eb commit 92de130

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

CMakeLists.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,19 @@ include(cmake/platform_feature_checks.cmake)
120120
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH})
121121
find_package(Sanitizers)
122122

123+
# Check for CXX support
124+
include(CheckLanguage)
125+
check_language(CXX)
126+
127+
# Enable CXX features if CXX is available
128+
if(CMAKE_CXX_COMPILER)
129+
message(STATUS "CXX compiler found, enable simdutf.")
130+
set(FLB_USE_SIMDUTF Yes)
131+
else()
132+
message(STATUS "CXX compiler not found, disable simdutf.")
133+
set(FLB_USE_SIMDUTF No)
134+
endif()
135+
123136
# Output paths
124137
set(FLB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
125138
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
@@ -139,7 +152,7 @@ option(FLB_COVERAGE "Build with code-coverage" No)
139152
option(FLB_JEMALLOC "Build with Jemalloc support" No)
140153
option(FLB_REGEX "Build with Regex support" Yes)
141154
option(FLB_UTF8_ENCODER "Build with UTF8 encoding support" Yes)
142-
option(FLB_UNICODE_ENCODER "Build with Unicode (UTF-16LE, UTF-16BE) encoding support" Yes)
155+
option(FLB_UNICODE_ENCODER "Build with Unicode (UTF-16LE, UTF-16BE) encoding support" ${FLB_USE_SIMDUTF})
143156
option(FLB_PARSER "Build with Parser support" Yes)
144157
option(FLB_TLS "Build with SSL/TLS support" Yes)
145158
option(FLB_BINARY "Build executable binary" Yes)

0 commit comments

Comments
 (0)