-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
40 lines (32 loc) · 842 Bytes
/
CMakeLists.txt
File metadata and controls
40 lines (32 loc) · 842 Bytes
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
cmake_minimum_required(VERSION 3.10)
project(abcparser C)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
# Compiler warnings
if(MSVC)
add_compile_options(/W4)
else()
add_compile_options(-Wall -Wextra -pedantic)
endif()
# Library
add_library(abc_parser STATIC
abc_parser.c
abc_parser.h
)
target_include_directories(abc_parser PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
# Executable
add_executable(abcparser main.c)
target_link_libraries(abcparser PRIVATE abc_parser)
# Math library on Unix
if(UNIX)
target_link_libraries(abcparser PRIVATE m)
endif()
# Test executable
add_executable(test_parser test_parser.c)
target_link_libraries(test_parser PRIVATE abc_parser)
if(UNIX)
target_link_libraries(test_parser PRIVATE m)
endif()
# Enable CTest
enable_testing()
add_test(NAME parser_tests COMMAND test_parser)