-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
55 lines (42 loc) · 1.47 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
cmake_minimum_required(VERSION 3.29)
project(mempatcher LANGUAGES CXX VERSION 0.2.1.0)
include(cmake/get_cpm.cmake)
include(cmake/GetGitRevisionDescription.cmake)
option(STATIC_MSVC_RUNTIME "Static link MSVC runtime" OFF)
if (STATIC_MSVC_RUNTIME)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
CPMAddPackage(
NAME spdlog
GIT_TAG v1.14.1
GITHUB_REPOSITORY gabime/spdlog
)
add_library(${PROJECT_NAME} SHARED
src/main.cc
src/util.cc
src/hooks.cc
src/patch.cc
src/parser.cc
res/mempatcher.rc
)
target_link_libraries(${PROJECT_NAME} spdlog)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_23)
target_precompile_headers(${PROJECT_NAME} PRIVATE src/pch.h)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/macros)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}64)
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}32)
else ()
message(FATAL_ERROR "Unsupported architecture")
endif()
get_git_head_revision(GIT_REFSPEC GIT_COMMIT_HASH)
if (NOT GIT_REFSPEC)
set(GIT_REFSPEC "release")
endif()
string(REPLACE "refs/heads/" "" GIT_BRANCH_NAME ${GIT_REFSPEC})
string(SUBSTRING ${GIT_COMMIT_HASH} 0 8 GIT_COMMIT_HASH_SHORT)
configure_file(src/buildinfo.h.in macros/buildinfo.h @ONLY)
if (BUILD_TESTING)
add_subdirectory(test)
endif()