-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
44 lines (37 loc) · 947 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
35
36
37
38
39
40
41
42
43
44
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
project(spms)
set(CMAKE_C_STANDARD 11)
# Extra warnings, treat warnings as error
if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU"
OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang"
OR "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang")
add_compile_options(-Wall -Wextra -Wpedantic -Werror -Wconversion)
endif()
add_library(spms
spms.c
)
target_include_directories(spms PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
add_library(spms::spms ALIAS spms)
if (NOT SPMS_DISABLE_TESTS)
add_executable(test_spms
test_spms.c
)
target_link_libraries(test_spms PUBLIC
spms::spms
)
endif()
if (NOT SPMS_DISABLE_EXAMPLES)
add_executable(example
example.c
)
target_link_libraries(example PUBLIC
spms::spms
)
if(UNIX AND NOT APPLE)
target_link_libraries(example PUBLIC
rt
)
endif()
endif()