-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
72 lines (63 loc) · 1.78 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
66
67
68
69
70
71
cmake_minimum_required (VERSION 3.16)
# 言語の設定
enable_language(CXX)
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/Zc:__cplusplus>")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# プロジェクト名
project ("SandS")
#
# info
#
message("# SandS")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
message("## x64")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
message("## x86")
else()
message("## x??")
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
message("## Debug")
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
message("## Release")
endif()
#
# macro
#
if(MSVC)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DUNICODE /D_UNICODE")
endif()
#
# warning
#
if(MSVC)
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif()
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/../release")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/../release")
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
# x64
add_subdirectory ("SandSDll")
add_subdirectory ("SandSHidden")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
# x86
add_subdirectory ("SandSDll")
add_subdirectory ("SandSExe")
add_subdirectory ("SandSHidden")
endif()