summaryrefslogtreecommitdiff
path: root/t/dlrestrictions/CMakeLists.txt
blob: 3995b39b3e770cd3a5e3d50387410edb17338e22 (plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
project(DLRestrictions_tests)

find_package(DLRestrictions REQUIRED NO_MODULE PATHS
    "${DLRestrictions_SOURCE_DIR}"
    "${DLRestrictions_BINARY_DIR}" NO_DEFAULT_PATH)

include_directories(${DLRestrictions_SOURCE_DIR})

add_library(testdlr_deeplib1 SHARED testdlr_deeplib1.c)
set_target_properties(testdlr_deeplib1 PROPERTIES
    OUTPUT_NAME "testdlr_deeplib"
    SOVERSION 1
    VERSION 1.0.0
)

add_library(testdlr_lib1 SHARED testdlr_lib1.c)
set_target_properties(testdlr_lib1 PROPERTIES
    OUTPUT_NAME "testdlr_lib"
    SOVERSION 1
    VERSION 1.0.0
    DLRESTRICTIONS "REJECT:OTHERSOVERSION"
)
target_link_libraries(testdlr_lib1 testdlr_deeplib1)
dlrestrictions_process_targets(testdlr_lib1)

add_library(testdlr_deeplib2 SHARED testdlr_deeplib2.c)
set_target_properties(testdlr_deeplib2 PROPERTIES
    OUTPUT_NAME "testdlr_deeplib"
    SOVERSION 2
    VERSION 2.0.0
)

add_library(testdlr_lib2 SHARED testdlr_lib2.c)
set_target_properties(testdlr_lib2 PROPERTIES
    OUTPUT_NAME "testdlr_lib"
    SOVERSION 2
    VERSION 2.0.0
)
target_link_libraries(testdlr_lib2 testdlr_deeplib1)

add_library(testdlr_plugin SHARED testdlr_plugin.c)
set_target_properties(testdlr_plugin PROPERTIES
    PREFIX ""
    SUFFIX ".so"
)
target_link_libraries(testdlr_plugin testdlr_lib1)

add_library(testdlr_plugin2 SHARED testdlr_plugin.c)
set_target_properties(testdlr_plugin2 PROPERTIES
    PREFIX ""
    SUFFIX ".so"
)
target_link_libraries(testdlr_plugin2 testdlr_lib1)

add_executable(testdlr_loader testdlr_loader.c)
target_link_libraries(testdlr_loader testdlr_lib2 ${CMAKE_DL_LIBS} dlrestrictions)

# Add DLR tests
add_test(testdlr_loader testdlr_loader)
set_tests_properties(testdlr_loader PROPERTIES PASS_REGULAR_EXPRESSION "FAILED dlr_dlopen_extended")