forked from dlfcn-win32/dlfcn-win32
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
35 lines (26 loc) · 883 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
cmake_minimum_required(VERSION 2.8)
if (NOT DEFINED CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release CACHE STRING "Build type")
endif ()
project (dlfcn C)
option(BUILD_SHARED_LIBS "shared/static libs" ON)
option(BUILD_TESTS "tests?" OFF)
set(headers dlfcn.h)
set(sources dlfcn.c)
if (BUILD_SHARED_LIBS)
add_definitions(-DSHARED)
endif (BUILD_SHARED_LIBS)
add_library(dl ${sources})
target_link_libraries(dl psapi)
install (TARGETS dl RUNTIME DESTINATION bin
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX})
install (FILES ${headers} DESTINATION include)
if (BUILD_TESTS)
enable_testing()
add_library(testdll SHARED testdll.c)
set_target_properties(testdll PROPERTIES PREFIX "")
add_executable(t_dlfcn test.c)
target_link_libraries(t_dlfcn dl)
add_test (NAME t_dlfcn COMMAND t_dlfcn)
endif ()