Skip to content

Commit ad9cc9d

Browse files
authored
Add a check before using -fno-define-target-os-macros (#125)
* Only enable -fno-define-target-os-macros for APPLE architecture * fixup! Add a check before using `-fno-define-target-os-macros`
1 parent 0f04db3 commit ad9cc9d

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

MultiSource/Applications/ClamAV/CMakeLists.txt

+11-5
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,15 @@ if(TARGET_OS STREQUAL "Linux")
178178
find_package(Intl REQUIRED)
179179
target_link_libraries(clamscan ${Intl_LIBRARIES})
180180
endif()
181-
# zlib fails to build with correctly defined target OS macros.
182-
# (https://github.com/madler/zlib/pull/895)
183-
# Disable the compiler extension to workaround the build failure until a zlib
184-
# source update with the fix.
185-
target_compile_options(clamscan PRIVATE -fno-define-target-os-macros)
181+
182+
include(CheckCCompilerFlag)
183+
check_c_compiler_flag(-fno-define-target-os-macros
184+
COMPILER_HAS_NO_DEFINE_TARGET_OS_MACROS)
185+
if (COMPILER_HAS_NO_DEFINE_TARGET_OS_MACROS)
186+
# zlib fails to build with correctly defined target OS macros.
187+
# (https://github.com/madler/zlib/pull/895)
188+
# Disable the compiler extension to workaround the build failure until a zlib
189+
# source update with the fix.
190+
target_compile_options(clamscan PRIVATE -fno-define-target-os-macros)
191+
endif()
186192
llvm_test_data(clamscan ${INPUT} dbdir)

0 commit comments

Comments
 (0)