-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
63 lines (53 loc) · 1.6 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
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
project(enduro2d-bootstrap)
#
# linking
#
if(MSVC)
option(BUILD_WITH_STATIC_CRT "Use static C runtime library" ON)
if(BUILD_WITH_STATIC_CRT)
foreach(flag CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${flag} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
endif()
if(${flag} MATCHES "/MDd")
string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
endif()
endforeach()
endif()
endif()
#
# enduro2d
#
set(E2D_BUILD_SAMPLES OFF CACHE INTERNAL "" FORCE)
set(E2D_BUILD_UNTESTS OFF CACHE INTERNAL "" FORCE)
set(E2D_BUILD_WITH_STATIC_CRT ${BUILD_WITH_STATIC_CRT} CACHE INTERNAL "" FORCE)
add_subdirectory(modules/enduro2d)
#
# sources
#
file(GLOB_RECURSE PROJECT_SOURCES
sources/*.*)
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES
${PROJECT_SOURCES})
#
# executable
#
add_executable(${PROJECT_NAME} ${PROJECT_SOURCES})
target_link_libraries(${PROJECT_NAME} enduro2d)
#
# resources
#
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/bin
$<TARGET_FILE_DIR:${PROJECT_NAME}>/bin)