-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
75 lines (61 loc) · 2.24 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
cmake_minimum_required(VERSION 2.8.12)
project (termq_lib)
enable_language(CXX)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra -pedantic-errors -Wno-unused-variable -pthread" )
include_directories("src" REQUIRED) # set as base dir for in-source `#includes'
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
message(STATUS "Found c++11 compiler: ${CMAKE_CXX_COMPILER}")
# Create necessary logs dir for spdlog
set(LOG_DIR "logs")
add_custom_target(make-logs-dir ALL
COMMAND ${CMAKE_COMMAND} -E make_directory ${LOG_DIR}
)
message(STATUS "Creating logs directory build/${LOG_DIR}")
include(FindPackageHandleStandardArgs)
find_path(NCURSES_INCLUDES
NAMES ncurses.h
PATHS
${INCLUDE_INSTALL_DIR}
)
find_library(NCURSES_LIBRARIES
NAMES ncurses
PATHS
${LIB_INSTALL_DIR}
)
find_package_handle_standard_args(ncurses DEFAULT_MSG NCURSES_INCLUDES NCURSES_LIBRARIES)
if(NCURSES_FOUND)
message(STATUS "Found ncurses: ${NCURSES_LIBRARIES}")
else(NCURSES_FOUND)
message(FATAL_ERROR "Could not find ncurses")
endif(NCURSES_FOUND)
include(ExternalProject)
ExternalProject_Add(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
CMAKE_ARGS -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG:PATH=DebugLibs
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE:PATH=ReleaseLibs
-DCMAKE_CXX_FLAGS=${MSVC_COMPILER_DEFS}
-Dgtest_force_shared_crt=${GTEST_FORCE_SHARED_CRT}
-Dgtest_disable_pthreads=${GTEST_DISABLE_PTHREADS}
-DBUILD_GTEST=ON
PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
# Disable install step
INSTALL_COMMAND ""
)
find_package(GTest REQUIRED)
find_package(Threads REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})
add_subdirectory(src)
add_subdirectory(test)
enable_testing()
add_test(TEST_VEC2UI test/Test_vec2ui)
add_test(TEST_ENTITY test/Test_entity)
add_test(TEST_ITEM test/Test_item)