-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
49 lines (40 loc) · 1.19 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
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
project(generic_iterators LANGUAGES C)
##################################################
# Configure some universal settings
# Set C language standard
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
# Disable non standard extensions
set(CMAKE_C_EXTENSIONS OFF)
# Don't skimp on warnings
if(MSVC)
add_compile_options(/W4 /WX)
else()
add_compile_options(-Wall -Wextra -pedantic -Werror)
endif()
if(WIN32)
# But ignore the Microsoft "Use *_s functions" warning
if (MSVC)
add_compile_options(/wd4996)
else()
add_compile_options(-Wno-deprecated-declarations)
endif()
endif()
# Add link time optimization (if possible) in release mode
if(CMAKE_BUILD_TYPE MATCHES Release)
include(CheckIPOSupported)
check_ipo_supported(RESULT supported OUTPUT output)
if(supported)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
else()
message(WARNING "IPO is not supported: ${output}")
endif()
endif()
# Set library name
set(LIBNAME iterators)
# Add the interface library target
add_library(${LIBNAME} INTERFACE)
# Add the headers to the library interface
target_include_directories(${LIBNAME} INTERFACE .)
add_subdirectory(examples)