-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathCMakeLists.txt
60 lines (42 loc) · 2.08 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
# Copyright (c) 2016 Juan Delgado (JuDelCo)
# License: MIT License
# MIT License web page: https://opensource.org/licenses/MIT
# ----------------------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.0)
if(NOT CONFIGURED_ONCE)
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Debug Release RelWithDebInfo MinSizeRel" FORCE)
set(BUILD_CPU_ARCH "x64" CACHE STRING "x86 x64")
endif()
if( NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug" AND
NOT ${CMAKE_BUILD_TYPE} STREQUAL "Release" AND
NOT ${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo" AND
NOT ${CMAKE_BUILD_TYPE} STREQUAL "MinSizeRel")
message(FATAL_ERROR "Bad CMAKE_BUILD_TYPE variable value (Debug Release RelWithDebInfo MinSizeRel)")
endif()
if( NOT ${BUILD_CPU_ARCH} STREQUAL "x86" AND
NOT ${BUILD_CPU_ARCH} STREQUAL "x64")
message(FATAL_ERROR "Bad BUILD_CPU_ARCH variable value (x86 x64)")
endif()
message(STATUS "CMAKE_BUILD_CONFIG: ${CMAKE_BUILD_TYPE} (${BUILD_CPU_ARCH})")
# -------------------------------------------------------------------------------------------------
set(CMAKE_CXX_FLAGS "-Wall -Werror -fmax-errors=5 -std=c++11")
set(CMAKE_CXX_FLAGS_DEBUG "-gdwarf-2 -Og -DDEBUG_ON") # -g
set(CMAKE_CXX_FLAGS_RELEASE "-s -O2")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin")
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR})
set(EXECUTABLE_NAME main_${CMAKE_BUILD_TYPE}_${BUILD_CPU_ARCH})
file(GLOB_RECURSE ENTITAS_SRC EntitasPP/*.*pp)
if(${BUILD_CPU_ARCH} STREQUAL "x64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
endif()
# -------------------------------------------------------------------------------------------------
project(EntitasPP CXX)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_executable(${EXECUTABLE_NAME}
main.cpp
${ENTITAS_SRC}
)
# -------------------------------------------------------------------------------------------------
set(CONFIGURED_ONCE TRUE CACHE INTERNAL "Flag - CMake has configured at least once")