-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
39 lines (30 loc) · 1.02 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
37
38
39
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(USE_WINE "use wine for test" 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()
if (USE_WINE)
find_program(WINE_EXECUTABLE NAMES wine)
endif ()
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 ${WINE_EXECUTABLE} t_dlfcn${CMAKE_EXECUTABLE_SUFFIX} )
endif ()