forked from nelhage/ministrace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
55 lines (42 loc) · 1.48 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
cmake_minimum_required(VERSION 3.3.2)
project(ministrace C)
set(CMAKE_C_STANDARD 99)
# -- Project settings --
# set(CMAKE_C_COMPILER clang)
# - CMake Debugging options -
# set(CMAKE_VERBOSE_MAKEFILE ON)
# set(CMAKE_DEBUG_TARGET_PROPERTIES INCLUDE_DIRECTORIES)
# -- Preprocessor / Compile options --
add_compile_options(
-Wall -Wextra -pedantic
-Wformat=2
-Wdouble-promotion
-Wfloat-equal
-Winit-self
-Wundef -Wunused-macros
-Wswitch-enum -Wswitch-default
$<$<COMPILE_LANGUAGE:C>:-Wstrict-prototypes>
# -Werror -pedantic-errors
)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(
-Walloc-zero
-Wformat-signedness
-Wduplicated-cond
-frecord-gcc-switches
# -march=native -mtune=native # ALWAYS optimize 4 local machine (since built binaries won't be distributed anyways); NOTE: Doesn't work currently w/ clang on Apple Silicone (SEE: https://discourse.llvm.org/t/why-does-march-native-not-work-on-apple-m1/2733)
)
endif()
# -- CMake options --
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
message(STATUS "No build type selected, defaulting to ** ${CMAKE_BUILD_TYPE} **")
endif()
# -- "Subdirs" containing projects --
add_subdirectory(src/)
add_subdirectory(test/)
# -- Print info --
message(STATUS "")
message(STATUS "Build type : ${CMAKE_BUILD_TYPE}")
message(STATUS "C Compiler exec : ${CMAKE_C_COMPILER}")
message(STATUS "")