mirror of
https://github.com/bitdefender/bddisasm.git
synced 2024-12-03 13:08:09 +00:00
build: Fix disasmtool LTO
This commit is contained in:
parent
d8f3046391
commit
f44ac0ce39
@ -8,6 +8,7 @@ option(BDD_USE_EXTERNAL_MEMSET "Expect nd_memset implementation from the integra
|
||||
option(BDD_NO_MNEMONIC "Exclude mnemonics - this option involves setting the BDDISASM_NO_FORMAT flag" OFF)
|
||||
option(BDD_ASAN "Build with ASAN" OFF)
|
||||
option(BDD_UBSAN "Build with UBSAN" OFF)
|
||||
option(BDD_LTO "Enable LTO" OFF)
|
||||
|
||||
set(BDD_VER_FILE ${CMAKE_CURRENT_LIST_DIR}/inc/bddisasm_version.h)
|
||||
|
||||
@ -220,6 +221,15 @@ set_target_properties(
|
||||
|
||||
add_library(bddisasm::bdshemu ALIAS bdshemu)
|
||||
|
||||
if (BDD_LTO)
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT USE_IPO)
|
||||
if (USE_IPO)
|
||||
set_target_properties(bddisasm PROPERTIES INTERPROCEDURAL_OPTIMIZATION True)
|
||||
set_target_properties(bdshemu PROPERTIES INTERPROCEDURAL_OPTIMIZATION True)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# If this is the master project (and if the user requested it) add disasmtool.
|
||||
if ((${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME}) AND BDD_INCLUDE_TOOL)
|
||||
add_subdirectory(disasmtool)
|
||||
|
@ -23,7 +23,7 @@ if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT USE_IPO)
|
||||
if (USE_IPO)
|
||||
set_target_properties(bddisasm PROPERTIES INTERPROCEDURAL_OPTIMIZATION True)
|
||||
set_target_properties(disasmtool PROPERTIES INTERPROCEDURAL_OPTIMIZATION True)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
@ -69,3 +69,25 @@ else ()
|
||||
-Wduplicated-cond)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (BDD_ASAN)
|
||||
target_compile_options(disasmtool PUBLIC "-fsanitize=address")
|
||||
target_link_libraries(disasmtool PUBLIC "-fsanitize=address")
|
||||
endif ()
|
||||
|
||||
if (BDD_UBSAN)
|
||||
target_compile_options(disasmtool PUBLIC
|
||||
"-fsanitize=undefined"
|
||||
"-fno-sanitize=alignment")
|
||||
target_link_libraries(disasmtool PUBLIC
|
||||
"-fsanitize=undefined"
|
||||
"-fno-sanitize=alignment")
|
||||
endif ()
|
||||
|
||||
if (BDD_LTO)
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT USE_IPO)
|
||||
if (USE_IPO)
|
||||
set_target_properties(disasmtool PROPERTIES INTERPROCEDURAL_OPTIMIZATION True)
|
||||
endif ()
|
||||
endif ()
|
||||
|
Loading…
Reference in New Issue
Block a user