-
Notifications
You must be signed in to change notification settings - Fork 19
/
ext_uriparser.cmake
56 lines (47 loc) · 1.7 KB
/
ext_uriparser.cmake
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
if(uriparser_link_lib)
return()
endif()
if(MSVC OR BMX_BUILD_URIPARSER_SOURCE)
include(FetchContent)
set(URIPARSER_BUILD_DOCS OFF CACHE INTERNAL "")
set(URIPARSER_BUILD_TESTS OFF CACHE INTERNAL "")
set(URIPARSER_BUILD_TOOLS OFF CACHE INTERNAL "")
if(EXISTS "${PROJECT_SOURCE_DIR}/deps/uriparser")
FetchContent_Declare(liburiparser
SOURCE_DIR "${PROJECT_SOURCE_DIR}/deps/uriparser"
)
message("-- Build using uriparser in deps/")
else()
FetchContent_Declare(liburiparser
GIT_REPOSITORY https://github.com/uriparser/uriparser
GIT_TAG uriparser-0.9.7
)
message("-- Build using uriparser from git repo")
endif()
FetchContent_GetProperties(liburiparser)
if(NOT liburiparser_POPULATED)
FetchContent_Populate(liburiparser)
add_subdirectory(${liburiparser_SOURCE_DIR} ${liburiparser_BINARY_DIR})
endif()
set(uriparser_link_lib uriparser)
else()
include(FindPkgConfig)
pkg_search_module(PC_uriparser uriparser liburiparser QUIET IMPORTED_TARGET)
if(PC_uriparser_FOUND)
set(uriparser_link_lib PkgConfig::PC_uriparser)
else()
find_library(LIB_uriparser uriparser)
if(NOT LIB_uriparser)
message(FATAL_ERROR "uriparser dependency not found")
endif()
find_path(uriparser_include_dirs
NAMES uriparser/Uri.h
)
add_library(liburiparser UNKNOWN IMPORTED)
set_target_properties(liburiparser PROPERTIES
IMPORTED_LOCATION ${LIB_uriparser_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${uriparser_include_dirs}
)
set(uriparser_link_lib liburiparser)
endif()
endif()