-no-unused-XXX options added for selective build mode (#3702)

This commit is contained in:
Vladislav Volkov 2021-01-29 06:53:42 +03:00 committed by GitHub
parent 2ebae7cf30
commit a67a72084f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,6 +51,15 @@ elseif(SELECTIVE_BUILD STREQUAL "ON")
target_compile_definitions(${TARGET_NAME} INTERFACE SELECTIVE_BUILD) target_compile_definitions(${TARGET_NAME} INTERFACE SELECTIVE_BUILD)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
OR CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
# After disabling a block of code, some variables might be unused.
target_compile_options(${TARGET_NAME} INTERFACE
-Wno-unused-function
-Wno-unused-parameter
-Wunused-local-typedefs)
endif()
set(GENERATED_HEADER ${CMAKE_CURRENT_BINARY_DIR}/conditional_compilation_gen.h) set(GENERATED_HEADER ${CMAKE_CURRENT_BINARY_DIR}/conditional_compilation_gen.h)
set(GENERATOR ${CMAKE_CURRENT_SOURCE_DIR}/scripts/ccheader.py) set(GENERATOR ${CMAKE_CURRENT_SOURCE_DIR}/scripts/ccheader.py)