-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
44 lines (33 loc) · 1.15 KB
/
CMakeLists.txt
File metadata and controls
44 lines (33 loc) · 1.15 KB
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 2.8)
project(tiny-process-library)
if(MSVC)
add_definitions(/D_CRT_SECURE_NO_WARNINGS)
else()
add_compile_options(-std=c++11 -Wall -Wextra)
endif()
add_library(tiny-process-library process.cpp)
if(WIN32)
target_sources(tiny-process-library PRIVATE process_win.cpp)
#If compiled using MSYS2, use sh to run commands
if(MSYS)
target_compile_definitions(tiny-process-library PUBLIC MSYS_PROCESS_USE_SH)
endif()
else()
target_sources(tiny-process-library PRIVATE process_unix.cpp)
endif()
find_package(Threads REQUIRED)
target_link_libraries(tiny-process-library ${CMAKE_THREAD_LIBS_INIT})
target_include_directories(tiny-process-library PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
option(BUILD_TESTING OFF)
# if tiny-process-library is not a sub-project:
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
add_executable(examples examples.cpp)
target_link_libraries(examples tiny-process-library)
set(BUILD_TESTING ON)
install(TARGETS tiny-process-library DESTINATION lib)
install(FILES process.hpp DESTINATION include)
endif()
if(BUILD_TESTING)
enable_testing()
add_subdirectory(tests)
endif()