-
Notifications
You must be signed in to change notification settings - Fork 0
/
wormhole-config.cmake.in
60 lines (47 loc) · 2.05 KB
/
wormhole-config.cmake.in
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
include(CMakeFindDependencyMacro)
find_dependency(Boost)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_dependency(Threads)
unset(CMAKE_THREAD_PREFER_PTHREAD)
get_filename_component(wormhole_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/@WORMHOLE_INSTALL_CMAKEDIR_REVERSE@/@WORMHOLE_INSTALL_INCLUDEDIR@" ABSOLUTE)
get_filename_component(wormhole_LIBRARY_DIR "${CMAKE_CURRENT_LIST_DIR}/@WORMHOLE_INSTALL_CMAKEDIR_REVERSE@/@WORMHOLE_INSTALL_LIBDIR@" ABSOLUTE)
if (wormhole_USE_SHARED_LIB)
add_library(wormhole SHARED IMPORTED)
else()
add_library(wormhole STATIC IMPORTED)
endif()
if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(_bt_postfix "d")
else()
set(_bt_postfix "")
endif()
if(WIN32 AND wormhole_USE_SHARED_LIB)
find_file(wormhole_DLL libwormhole${_bt_postfix}.dll PATHS "${wormhole_LIBRARY_DIR}" NO_DEFAULT_PATH)
find_file(wormhole_LIB libwormhole${_bt_postfix}.lib PATHS "${wormhole_LIBRARY_DIR}" NO_DEFAULT_PATH)
if(NOT wormhole_DLL)
message(FATAL_ERROR "wormhole shared library ${wormhole_DLL} not found")
endif()
if(NOT wormhole_LIB)
message(FATAL_ERROR "wormhole import library ${wormhole_LIB} not found")
endif()
set_target_properties(wormhole PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${wormhole_INCLUDE_DIR}
IMPORTED_IMPLIB "${wormhole_LIB}"
IMPORTED_LOCATION "${wormhole_DLL}")
else()
if (WIN32)
find_file(wormhole_LIB libwormhole${_bt_postfix}-static.lib PATHS "${wormhole_LIBRARY_DIR}" NO_DEFAULT_PATH)
elseif(wormhole_USE_SHARED_LIB)
find_file(wormhole_LIB libwormhole${_bt_postfix}.so PATHS "${wormhole_LIBRARY_DIR}" NO_DEFAULT_PATH)
else()
find_file(wormhole_LIB libwormhole${_bt_postfix}.a PATHS "${wormhole_LIBRARY_DIR}" NO_DEFAULT_PATH)
endif()
if(NOT wormhole_LIB)
message(FATAL_ERROR "wormhole library ${wormhole_LIB} not found")
endif()
set_target_properties(wormhole PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${wormhole_INCLUDE_DIR}
IMPORTED_LOCATION "${wormhole_LIB}")
endif()
unset(_bt_postfix)
set(wormhole_FOUND TRUE)