This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
/
CMakeLists.txt
106 lines (83 loc) · 2.97 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# Copyright (C) 2017 Quentin "Naccyde" Deslandes.
# Redistribution and use of this file is allowed according to the terms of the MIT license.
# For details see the LICENSE file distributed with yall.
cmake_minimum_required(VERSION 3.6)
project(yall)
set(pthread_HINTS "" CACHE STRING "Hint to find pthread directory")
set(criterion_HINTS "" CACHE STRING "Hint to find criterion directory")
option(TARGET_EXT_INFOS "Display extended infos about the CMake targets" OFF)
# Compiler flags
set(CMAKE_C_FLAGS "")
set(CMAKE_C_FLAGS_DEBUG "")
set(CMAKE_C_FLAGS_RELEASE "")
set(CMAKE_CXX_FLAGS "")
set(CMAKE_CXX_FLAGS_DEBUG "")
set(CMAKE_CXX_FLAGS_RELEASE "")
# Output directories
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/binaries)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/binaries)
set(CMAKE_PDB_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/binaries)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/binaries)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/binaries)
if (UNIX AND CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "Release")
endif ()
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_SOURCE_DIR}/resources/cmake/module")
if (WIN32)
set_property(GLOBAL PROPERTY USE_FOLDERS On)
set(pthread_HINTS "${pthread_HINTS}" "${CMAKE_SOURCE_DIR}/external")
set(criterion_HINTS "${criterion_HINTS}" "${CMAKE_SOURCE_DIR}/external")
set(jansson_HINTS "${jansson_HINTS}" "${CMAKE_SOURCE_DIR}/external")
endif ()
find_package(jansson REQUIRED)
find_package(pthread REQUIRED)
find_package(criterion REQUIRED)
if (UNIX)
find_package(Doxygen REQUIRED)
endif ()
#[[
Project version
#]]
if (NOT YALL_VERSION_MAJOR)
set(YALL_VERSION_MAJOR 0)
endif ()
if (NOT YALL_VERSION_MINOR)
set(YALL_VERSION_MINOR 0)
endif ()
if (NOT YALL_VERSION_PATCH)
set(YALL_VERSION_PATCH 0)
endif ()
set(YALL_VERSION "${YALL_VERSION_MAJOR}.${YALL_VERSION_MINOR}.${YALL_VERSION_PATCH}")
configure_file("${PROJECT_SOURCE_DIR}/include/version.h.in" "${PROJECT_BINARY_DIR}/generated_headers/version.h")
message("==== Building yall version ${YALL_VERSION_MAJOR}.${YALL_VERSION_MINOR}.${YALL_VERSION_PATCH}")
#[[
CMake internal configuration
#]]
set(CMAKE_CONFIGURATION_TYPES "" CACHE STRING "" FORCE)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}Debug;" CACHE STRING "" FORCE)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}Release;" CACHE STRING "" FORCE)
set(CMAKE_DEBUG_POSTFIX d)
#[[
System specific variables
#]]
if (UNIX)
if (CMAKE_COMPILER_IS_GNUCC)
set(COMPILER "gcc-${CMAKE_C_COMPILER_VERSION}")
else ()
set(COMPILER "linux_unknow")
endif ()
link_directories(${CMAKE_SOURCE_DIR}/external/lib/linux)
elseif (WIN32)
if (MSVC_VERSION EQUAL 1900)
set(COMPILER "msvc14")
elseif (MSVC_VERSION EQUAL 1800)
set(COMPILER "msvc12")
else ()
set(COMPILER "windows_unknow")
endif ()
endif ()
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/out/public/doxygen)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/out/coverage)
add_subdirectory(src)
add_subdirectory(tests)
add_subdirectory(doc)