-
Notifications
You must be signed in to change notification settings - Fork 13
/
CMakeLists.txt
34 lines (29 loc) · 1.05 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
cmake_minimum_required(VERSION 3.0)
project(gptgen VERSION 1.2.1 LANGUAGES CXX)
if(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)
set(USING_CLANG TRUE)
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
set(USING_GCC TRUE)
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
set(USING_MSVC TRUE)
endif()
if(USING_CLANG OR USING_GCC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wextra -Werror -O0 -ggdb -DDEBUG")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "${CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT} -O2 -ggdb")
if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWINDOWS_BUILD")
endif()
elseif(USING_MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DWINDOWS_BUILD")
elseif(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMACOS_BUILD")
endif()
add_executable(gptgen "gptgen.cpp")
if(WIN32)
install(TARGETS gptgen DESTINATION gptgen)
else()
install(TARGETS gptgen DESTINATION sbin)
endif()