-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
70 lines (61 loc) · 2.35 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
# Copyright (c) 2023 Eliah Kagan
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
cmake_minimum_required(VERSION 3.0.0)
project(Pool VERSION 0.1.0)
include(CTest)
enable_testing()
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_C_STANDARD 90)
set(CMAKE_C_STANDARD_REQUIRE ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(MSVC)
# cl and clang-cl accept /W4 (but -Weverything will override in clang-cl).
string(REGEX REPLACE /W[123] /W4 CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
string(REGEX REPLACE /W[123] /W4 CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
# cl and clang-cl accept /permissive- for stricter conformance.
add_compile_options(/permissive-)
else()
# gcc/g++ and clang/clang++ require comparably strict conformance to
# /permissive- unless -fpermissive is passed. But they accept -pedantic
# for even more conformance warnings, and -pedantic-errors for errors.
add_compile_options(-pedantic-errors)
endif()
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
# Clang accepts -Weverything with both clang/clang++ and clang-cl.
# We will keep all but a few of the warnings that -Weverything enables.
add_compile_options(
-Weverything
-Wno-c++98-compat
-Wno-c++98-compat-bind-to-temporary-copy
-Wno-padded
)
elseif(MSVC)
# cl but not clang-cl accepts /Za to reject Microsoft extensions.
add_compile_options(/Za)
# cl but not clang-cl accepts /analyze for static analysis (default rules).
add_compile_options(/analyze)
else()
# Enable most warnings.
add_compile_options(-Wall -Wextra)
endif()
add_executable(cgrep
cgrep.c
match.cpp match.h
readln.cpp readln.h
noreturn.h
)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)