Specify compiler options only for C

This commit is contained in:
Kasper Sauramo
2025-03-27 12:31:53 +02:00
parent c3f240624c
commit 89beab3506

View File

@@ -15,8 +15,6 @@ endif()
# Common compile options # Common compile options
add_compile_options("-fvisibility=hidden") add_compile_options("-fvisibility=hidden")
# TODO: Get -Wpadded back somehow.
add_compile_options("-Wno-declaration-after-statement" "-Wno-padded")
# Handle 3rd party dependencies # Handle 3rd party dependencies
# ############################# # #############################
@@ -53,10 +51,12 @@ add_library(hiload SHARED
# dependencies # dependencies
src/logger/sc_log.c src/logger/sc_log.c
) )
# TODO: Get -Wpadded back by refactoring sc_array or just surround
# all type sc_array declarations with the ignore pragma
target_compile_options(hiload PRIVATE target_compile_options(hiload PRIVATE
$<$<C_COMPILER_ID:GNU>:-Wall -Wextra> $<$<C_COMPILER_ID:GNU>:-Wall -Wextra>
$<$<C_COMPILER_ID:Clang>:-Weverything> $<$<C_COMPILER_ID:Clang>:-Weverything>
$<$<COMPILE_LANGUAGE:C>:-Wno-declaration-after-statement -Wno-padded>
) )
target_link_libraries(hiload dl) target_link_libraries(hiload dl)
@@ -93,10 +93,12 @@ add_library(auditor-x86_64 SHARED
src/auditor/auditor-x86_64.c src/auditor/auditor-x86_64.c
) )
target_compile_options(hiload PRIVATE target_compile_options(auditor-x86_64 PRIVATE
$<$<C_COMPILER_ID:GNU>:-Wall -Wextra> $<$<C_COMPILER_ID:GNU>:-Wall -Wextra>
$<$<C_COMPILER_ID:Clang>:-Weverything> $<$<C_COMPILER_ID:Clang>:-Weverything>
) )
target_compile_options(auditor-x86_64 PRIVATE
-Wno-unused-parameter)
install(TARGETS auditor-x86_64 install(TARGETS auditor-x86_64
EXPORT auditor-x86_64Targets EXPORT auditor-x86_64Targets