Skip to content

Commit c8d4a76

Browse files
author
Joshua Bradt
committed
Updated CMakeLists.txt to better set compile flags.
1 parent eee8c5c commit c8d4a76

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

CMakeLists.txt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
project(ThreadPool)
22
cmake_minimum_required(VERSION 3.1)
33

4-
set(CMAKE_CXX_STANDARD 11)
5-
64
include_directories(include)
7-
add_definitions(-Wall -Wextra -pedantic)
5+
6+
set(WARNING_FLAGS -Wall -Wextra -pedantic)
7+
8+
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
9+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
10+
endif()
811

912
add_library(ThreadPool SHARED src/ThreadPool.cc)
13+
target_compile_options(ThreadPool PUBLIC ${WARNING_FLAGS})
14+
set_target_properties(ThreadPool PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED True)
15+
1016
install(TARGETS ThreadPool LIBRARY DESTINATION lib)
1117
install(FILES include/ThreadPool.hh DESTINATION include)
1218

1319
add_executable(test_ThreadPool test/test_ParallelMap.cc test/catch_main.cc)
1420
target_link_libraries(test_ThreadPool ThreadPool)
21+
target_compile_options(test_ThreadPool PUBLIC ${WARNING_FLAGS})
22+
set_target_properties(test_ThreadPool PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED True)

0 commit comments

Comments
 (0)