-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
86 lines (72 loc) · 2.56 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#
# See
# https://cmake.org/cmake/help/v3.0/manual/cmake-commands.7.html
# http://www.slideshare.net/DanielPfeifer1/cmake-48475415
#
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
# Project(<name> VERSION <version> LANGUAGES CXX)
project(EVNOpenPoker C CXX ASM)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" "${CMAKE_MODULE_PATH}")
# turns on colors in generated Makefile
set(CMAKE_COLOR_MAKEFILE)
# overwriting the source and binary directories with the current ones
# this is useful for other projects reusing this project as a subcomponent
set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
# this will prohibit in-source-builds
if(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
message(STATUS "In-source-builds are not allowed")
message(STATUS "Clean your source directory (e.g. delete the CMakeCache.txt file)")
message(FATAL_ERROR "Please create a separate build directory and call CMake again")
endif(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
# CMAKE_BUILD_TYPE can be Release/Debug
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Debug")
message(STATUS "To change pass -DCMAKE_BUILD_TYPE on command line")
set(CMAKE_BUILD_TYPE "Debug")
endif()
set (CXX_STANDARD "c++14")
#include(FindGTEST)
enable_testing()
# separate out the C++ options which are not used in C
# add boost logger macro
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=${CXX_STANDARD} -Woverloaded-virtual -DBOOST_LOG_DYN_LINK")
# these below apply to C and C++ files
add_compile_options(
-Wall
-Wextra
-Werror
-Wstrict-aliasing
-Wno-unused-parameter
-Wno-missing-field-initializers
-Wno-unused-but-set-parameter
# -Wimplicit-fallthrough=0
-Wchar-subscripts
-Wpointer-arith
-Wformat
-Wformat-security
-Werror=format-security
-fstack-protector-all
-fPIE
-fpie
-fPIC
-fpic
-pipe
-fdata-sections
-ffunction-sections
)
include(CTest)
# all headers specified
include_directories(
${CMAKE_SOURCE_DIR}/src
${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/third_party/SKPokerEval/src
${CMAKE_SOURCE_DIR}/third_party/Kmeans/src
)
message(${CMAKE_SOURCE_DIR})
# Include cppcheck target. must come after compiler flags defined
#include(cppcheck)
add_subdirectory(src)
add_subdirectory(third_party/googletest/googletest/)
add_subdirectory(third_party/SKPokerEval/)
add_subdirectory(third_party/Kmeans/)