forked from tinycthread/tinycthread
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
36 lines (29 loc) · 1.33 KB
/
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
cmake_minimum_required(VERSION 2.8.4)
project(TinyCThread)
enable_testing()
find_package(Threads REQUIRED)
add_library(tinycthread STATIC source/tinycthread.c)
target_link_libraries(tinycthread ${CMAKE_THREAD_LIBS_INIT})
set_property(TARGET tinycthread APPEND PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/source")
set_property(TARGET tinycthread APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/source")
set_property(TARGET tinycthread PROPERTY POSITION_INDEPENDENT_CODE True)
option(TINYCTHREAD_DISABLE_TESTS "Disable TinyCThread unit tests")
option(TINYCTHREAD_INSTALL "Install a static library for TinyCThread")
if(NOT TINYCTHREAD_DISABLE_TESTS)
add_executable(test-tinycthread "${CMAKE_CURRENT_SOURCE_DIR}/test/test.c")
target_link_libraries(test-tinycthread tinycthread)
add_test(NAME tinycthread
COMMAND $<TARGET_FILE:test-tinycthread>)
endif(NOT TINYCTHREAD_DISABLE_TESTS)
if(TINYCTHREAD_INSTALL)
if(CMAKE_INSTALL_LIBDIR)
install(TARGETS tinycthread ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
else()
install(TARGETS tinycthread ARCHIVE DESTINATION lib)
endif()
if(CMAKE_INSTALL_INCLUDEDIR)
install(FILES source/tinycthread.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
else()
install(FILES source/tinycthread.h DESTINATION include)
endif()
endif(TINYCTHREAD_INSTALL)