-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
34 lines (27 loc) · 923 Bytes
/
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
cmake_minimum_required(VERSION 3.12)
project(cio)
set(CMAKE_MACOSX_RPATH 1)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall")
option(BUILD_DEBUG "Build with debug info." OFF)
if (BUILD_DEBUG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
message(STATUS "Build with -g for debug")
else ()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
message(STATUS "Build without -g but with -O3 for release")
endif ()
option(BUILD_STATIC "Build static library" ON)
option(BUILD_SHARED "Build shared library" ON)
add_subdirectory(src)
option(BUILD_TESTS "Build all tests." OFF)
if (BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif ()
option(BUILD_EXAMPLES "Build all examples." OFF)
if (BUILD_EXAMPLES)
add_subdirectory(examples)
endif ()