Cleanup CMakeLists.txt

pull/32/head
Bogdan-Viorel BOSINTA 3 years ago
parent 1aa0e0d71b
commit 704e452353

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

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

Loading…
Cancel
Save