-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
55 lines (43 loc) · 1005 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
45
46
47
48
49
50
51
52
53
54
55
cmake_minimum_required(VERSION 3.7)
project(ThreadPool)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
option(ENABLE_TESTING "Build the tests" OFF)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
file(GLOB LIB_SOURCE_FILES "src/*.cpp")
add_library(ThreadPool STATIC ${LIB_SOURCE_FILES})
target_include_directories(
ThreadPool
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc>"
)
target_link_libraries(
ThreadPool
Threads::Threads
)
set_target_properties(
ThreadPool
PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)
target_compile_options(
ThreadPool
PUBLIC
-Wall
-Werror
-Wextra
-Wpedantic
-pedantic-errors
)
if(ENABLE_TESTING)
enable_testing()
add_subdirectory(test)
add_custom_target(
check
COMMAND ${CMAKE_CTEST_COMMAND}
--force-new-ctest-process
--verbose)
endif()
export(TARGETS ThreadPool NAMESPACE ThreadPool:: FILE ThreadPool-exports.cmake)