1
0
mirror of https://github.com/bitdefender/bddisasm.git synced 2024-12-22 22:18:09 +00:00

Cleanup CMakeLists.txt

This commit is contained in:
Bogdan-Viorel BOSINTA 2020-11-20 14:43:12 +02:00
parent 1aa0e0d71b
commit 704e452353
2 changed files with 20 additions and 20 deletions

View File

@ -55,7 +55,6 @@ add_dependencies(bdshemu bddisasm)
include_directories( include_directories(
inc inc
inc/bdshemu
bddisasm/include bddisasm/include
) )
@ -65,7 +64,7 @@ else ()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -D_DEBUG -DDEBUG") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -D_DEBUG -DDEBUG")
endif () endif ()
add_compile_options( set(BDDISASM_COMPILE_OPTIONS
"$<$<CONFIG:Release>:-U_FORTIFY_SOURCE>" "$<$<CONFIG:Release>:-U_FORTIFY_SOURCE>"
"$<$<CONFIG:Release>:-D_FORTIFY_SOURCE=2>" "$<$<CONFIG:Release>:-D_FORTIFY_SOURCE=2>"
-Wall -Wall
@ -78,14 +77,10 @@ add_compile_options(
-Wwrite-strings -Wwrite-strings
-Wshadow -Wshadow
-Winit-self -Winit-self
-Wswitch-default
-Wmissing-variable-declarations
-Wused-but-marked-unused
-Wswitch-enum
-Wno-unused-function -Wno-unused-function
-Wno-multichar -Wno-multichar
-Wno-incompatible-pointer-types -Wno-incompatible-pointer-types
-Wcast-qual -Wno-discarded-qualifiers
-Wnull-dereference -Wnull-dereference
-Wduplicated-cond -Wduplicated-cond
-Werror=format-security -Werror=format-security
@ -103,6 +98,9 @@ add_compile_options(
-march=nehalem -march=nehalem
) )
target_compile_options(bddisasm PRIVATE ${BDDISASM_COMPILE_OPTIONS})
target_compile_options(bdshemu PRIVATE ${BDDISASM_COMPILE_OPTIONS})
include(GNUInstallDirs) include(GNUInstallDirs)
set(CMAKE_SKIP_BUILD_RPATH TRUE) set(CMAKE_SKIP_BUILD_RPATH TRUE)

View File

@ -41,7 +41,11 @@ else()
message(FATAL_ERROR "Dependency: rapidjson not found") message(FATAL_ERROR "Dependency: rapidjson not found")
endif() endif()
add_compile_options(
add_executable(${PROJECT_NAME} ${disasmtool_src_files})
target_compile_options(${PROJECT_NAME} PRIVATE
"$<$<CONFIG:Release>:-U_FORTIFY_SOURCE>" "$<$<CONFIG:Release>:-U_FORTIFY_SOURCE>"
"$<$<CONFIG:Release>:-D_FORTIFY_SOURCE=2>" "$<$<CONFIG:Release>:-D_FORTIFY_SOURCE=2>"
-Wall -Wall
@ -81,7 +85,7 @@ set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -Wl,
if (CMAKE_COMPILER_IS_GNUCXX) if (CMAKE_COMPILER_IS_GNUCXX)
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 6.0)) if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 6.0))
add_compile_options( target_compile_options(${PROJECT_NAME} PRIVATE
-Wshift-overflow=2 -Wshift-overflow=2
-Wnull-dereference -Wnull-dereference
-Wduplicated-cond -Wduplicated-cond
@ -91,7 +95,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
endif() endif()
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 7.0)) if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 7.0))
add_compile_options( target_compile_options(${PROJECT_NAME} PRIVATE
-Wdangling-else -Wdangling-else
-Wshadow=global -Wshadow=global
-Walloc-zero -Walloc-zero
@ -99,7 +103,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
endif() endif()
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 8.0)) if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 8.0))
add_compile_options( target_compile_options(${PROJECT_NAME} PRIVATE
-Wmultistatement-macros -Wmultistatement-macros
-Warray-bounds=2 -Warray-bounds=2
-Wformat-overflow=2 -Wformat-overflow=2
@ -127,7 +131,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
endif() endif()
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 9.0)) if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 9.0))
add_compile_options( target_compile_options(${PROJECT_NAME} PRIVATE
-Wcatch-value=2 -Wcatch-value=2
-Wduplicated-branches -Wduplicated-branches
-Wextra-semi -Wextra-semi
@ -140,12 +144,12 @@ if (CMAKE_COMPILER_IS_GNUCXX)
) )
endif() endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options( target_compile_options(${PROJECT_NAME} PRIVATE
-Wno-missing-braces -Wno-missing-braces
) )
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 6.0)) if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 6.0))
add_compile_options( target_compile_options(${PROJECT_NAME} PRIVATE
-Wshift-overflow -Wshift-overflow
-Wnull-dereference -Wnull-dereference
-Wvla -Wvla
@ -157,7 +161,7 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
endif() endif()
if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 10.0)) if (NOT (CMAKE_CXX_COMPILER_VERSION LESS 10.0))
add_compile_options( target_compile_options(${PROJECT_NAME} PRIVATE
-Warray-bounds-pointer-arithmetic -Warray-bounds-pointer-arithmetic
-Wassign-enum -Wassign-enum
-Watomic-implicit-seq-cst -Watomic-implicit-seq-cst
@ -251,20 +255,18 @@ else()
message(FATAL_ERROR "Unsupported compiler!") message(FATAL_ERROR "Unsupported compiler!")
endif() endif()
include_directories( target_include_directories(${PROJECT_NAME} PRIVATE
${DISASM_DIRECTORY}/inc ${DISASM_DIRECTORY}/inc
${DISASM_DIRECTORY}/bddisasm/include ${DISASM_DIRECTORY}/bddisasm/include
) )
add_executable(${CMAKE_PROJECT_NAME} ${disasmtool_src_files})
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release") if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
include(CheckIPOSupported) include(CheckIPOSupported)
check_ipo_supported(RESULT USE_IPO) check_ipo_supported(RESULT USE_IPO)
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION True) set_target_properties(${PROJECT_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION True)
endif() endif()
set_target_properties(${CMAKE_PROJECT_NAME} set_target_properties(${PROJECT_NAME}
PROPERTIES PROPERTIES
POSITION_INDEPENDENT_CODE ON POSITION_INDEPENDENT_CODE ON
CXX_STANDARD 17 CXX_STANDARD 17