2021-03-30 09:20:31 +00:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
|
|
|
|
|
|
|
project(disasmtool LANGUAGES C)
|
|
|
|
|
|
|
|
# Use Release as the build type if no build type was specified and we're not using a multi-config generator .
|
2021-03-30 09:36:35 +00:00
|
|
|
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
2021-03-30 09:20:31 +00:00
|
|
|
message(STATUS "No build type given. Will use 'Release'")
|
2021-03-30 09:20:47 +00:00
|
|
|
set(CMAKE_BUILD_TYPE
|
|
|
|
"Release"
|
|
|
|
CACHE STRING "Choose the type of build." FORCE)
|
2021-03-30 09:20:31 +00:00
|
|
|
# Set the possible values of build type for cmake-gui.
|
|
|
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
|
2021-03-30 09:36:35 +00:00
|
|
|
endif ()
|
2021-03-30 09:20:31 +00:00
|
|
|
|
2021-07-08 09:40:39 +00:00
|
|
|
if (NOT TARGET bddisasm)
|
|
|
|
find_package(bddisasm REQUIRED)
|
|
|
|
endif ()
|
|
|
|
|
2021-03-30 09:20:31 +00:00
|
|
|
add_executable(disasmtool disasmtool.c)
|
|
|
|
target_link_libraries(disasmtool PRIVATE bddisasm::bddisasm bddisasm::bdshemu)
|
|
|
|
|
2021-03-30 09:36:35 +00:00
|
|
|
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
2021-03-30 09:20:31 +00:00
|
|
|
include(CheckIPOSupported)
|
|
|
|
check_ipo_supported(RESULT USE_IPO)
|
2021-03-30 09:36:35 +00:00
|
|
|
if (USE_IPO)
|
2021-03-30 09:20:31 +00:00
|
|
|
set_target_properties(bddisasm PROPERTIES INTERPROCEDURAL_OPTIMIZATION True)
|
2021-03-30 09:36:35 +00:00
|
|
|
endif ()
|
|
|
|
endif ()
|
2021-03-30 09:20:31 +00:00
|
|
|
|
2022-12-05 09:41:38 +00:00
|
|
|
if (MSVC OR "${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC")
|
|
|
|
target_compile_options(disasmtool PRIVATE /W4 /WX)
|
|
|
|
|
|
|
|
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
|
|
|
|
target_compile_options(disasmtool PRIVATE -Wno-format)
|
|
|
|
endif ()
|
|
|
|
else ()
|
2021-03-30 09:20:47 +00:00
|
|
|
target_compile_options(
|
|
|
|
disasmtool
|
|
|
|
PRIVATE -Wall
|
|
|
|
-Wno-unknown-pragmas
|
|
|
|
-Wextra
|
|
|
|
-Wshadow
|
2022-12-05 09:41:38 +00:00
|
|
|
-Wno-format
|
|
|
|
-Wno-cast-function-type
|
2021-03-30 09:20:47 +00:00
|
|
|
-Wstrict-overflow=2
|
|
|
|
-Wstrict-prototypes
|
|
|
|
-Wwrite-strings
|
|
|
|
-Wshadow
|
|
|
|
-Winit-self
|
|
|
|
-Wno-unused-function
|
|
|
|
-Wno-multichar
|
|
|
|
-Wno-incompatible-pointer-types
|
|
|
|
-Wno-discarded-qualifiers
|
|
|
|
-Wnull-dereference
|
|
|
|
-Wduplicated-cond
|
|
|
|
-Werror=implicit-function-declaration
|
|
|
|
-pipe
|
|
|
|
-fwrapv
|
|
|
|
-fno-strict-aliasing
|
|
|
|
-fstack-protector-strong
|
|
|
|
-fno-omit-frame-pointer
|
|
|
|
-ffunction-sections
|
|
|
|
-fdata-sections
|
|
|
|
-g3
|
|
|
|
-gdwarf-4
|
|
|
|
-grecord-gcc-switches
|
|
|
|
-march=westmere)
|
2021-03-30 09:36:35 +00:00
|
|
|
endif ()
|