forked from xorangekiller/gptgen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
36 lines (30 loc) · 987 Bytes
/
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
cmake_minimum_required(VERSION 3.0)
project(gptgen VERSION 1.2 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 "-Wall")
set(CMAKE_CXX_FLAGS_DEBUG "-Wextra -Werror -O0 -ggdb -DDEBUG")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(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 "/DWINDOWS_BUILD")
endif()
add_executable(gptgen "gptgen.cpp")
if(NOT DEFINED GPTGEN_INSTALL_PREFIX)
if(WIN32)
set(GPTGEN_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/gptgen")
else()
set(GPTGEN_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/sbin")
endif()
endif()
install(TARGETS gptgen DESTINATION ${GPTGEN_INSTALL_PREFIX})