-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
65 lines (52 loc) · 1.73 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
cmake_minimum_required(VERSION 3.21)
project(memscan)
# verify platform
if (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
message(FATAL_ERROR "${PROJECT_NAME}: Your platform is currently not supported.")
endif()
# verify compiler
if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
message("${PROJECT_NAME}: Your compiler is not officially supported. Issues or build errors may occur.")
endif()
# x86
set(CMAKE_SYSTEM_PROCESSOR "i686")
set(ARCH "x86")
# C or C++
set(IS_C ON)
# files
file(GLOB_RECURSE MEMSCAN
"${PROJECT_SOURCE_DIR}/src/memscan/util/util.c"
"${PROJECT_SOURCE_DIR}/src/memscan/memscan.c"
)
# create library
if (IS_C)
add_library(${PROJECT_NAME} SHARED ${MEMSCAN} "${PROJECT_SOURCE_DIR}/src/test.c")
else()
add_library(${PROJECT_NAME} SHARED ${MEMSCAN} "${PROJECT_SOURCE_DIR}/src/test.cpp")
endif()
# set standard
if (IS_C)
set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99)
set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD_REQUIRED ON)
else()
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
endif()
# multi-processor compilation
add_definitions(/MP)
# max warnings
add_definitions(/W4)
add_definitions(/WX)
# options
macro(set_option option help value)
option(${option} ${help} ${value})
if(${option})
message(STATUS "${PROJECT_NAME}: ${option}: ON")
target_compile_definitions(${PROJECT_NAME} PUBLIC ${option})
else()
message(STATUS "${PROJECT_NAME}: ${option}: OFF")
endif()
endmacro()
set_option(MEMSCAN_UNSAFE_OPTIMIZATIONS "Remove memscan safety checks" OFF)
set_option(UTIL_UNSAFE_OPTIMIZATIONS "Remove util safety checks" OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)