generated from ut-issl/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 19
/
common.cmake
39 lines (33 loc) · 1.53 KB
/
common.cmake
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
# C++
set_target_properties(${PROJECT_NAME} PROPERTIES LANGUAGE CXX)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_EXTENSIONS FALSE)
# common include
target_include_directories(${PROJECT_NAME} PUBLIC ${S2E_DIR}/src)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
# Directory path setting
target_compile_definitions(${PROJECT_NAME} PRIVATE "SETTINGS_DIR_FROM_EXE=\"${SETTINGS_DIR_FROM_EXE}\"")
target_compile_definitions(${PROJECT_NAME} PRIVATE "EXT_LIB_DIR_FROM_EXE=\"${EXT_LIB_DIR_FROM_EXE}\"")
target_compile_definitions(${PROJECT_NAME} PRIVATE "CORE_DIR_FROM_EXE=\"${CORE_DIR_FROM_EXE}\"")
# Compile option
if(MSVC)
target_compile_options(${PROJECT_NAME} PUBLIC "/MP") # multi process build
target_compile_options(${PROJECT_NAME} PUBLIC "/W4")
if(NOT USE_HILS) # /MT option conflicts /clr option in the HILS config.
target_compile_options(${PROJECT_NAME} PUBLIC "/MT")
endif()
target_compile_options(${PROJECT_NAME} PUBLIC "/source-charset:utf-8")
else()
target_compile_options(${PROJECT_NAME} PUBLIC "-Wall")
target_compile_options(${PROJECT_NAME} PUBLIC "-Wextra")
target_compile_options(${PROJECT_NAME} PUBLIC "-Wpedantic")
# link option
target_link_options(${PROJECT_NAME} PUBLIC "-rdynamic")
if(NOT BUILD_64BIT)
# 32bit
target_compile_options(${PROJECT_NAME} PUBLIC "-m32")
target_link_options(${PROJECT_NAME} PUBLIC "-m32")
endif()
# debug
target_compile_options(${PROJECT_NAME} PUBLIC "-g")
endif()