-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathext_expat.cmake
47 lines (38 loc) · 1.27 KB
/
ext_expat.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
if(expat_link_lib)
return()
endif()
if(MSVC OR BMX_BUILD_EXPAT_SOURCE)
include(FetchContent)
set(EXPAT_BUILD_DOCS OFF CACHE INTERNAL "")
set(EXPAT_BUILD_EXAMPLES OFF CACHE INTERNAL "")
set(EXPAT_BUILD_TESTS OFF CACHE INTERNAL "")
set(EXPAT_BUILD_TOOLS OFF CACHE INTERNAL "")
if(BUILD_SHARED_LIBS)
set(EXPAT_SHARED_LIBS ON CACHE INTERNAL "")
else()
set(EXPAT_SHARED_LIBS OFF CACHE INTERNAL "")
endif()
if(EXISTS "${PROJECT_SOURCE_DIR}/deps/libexpat")
FetchContent_Declare(FT_libexpat
SOURCE_DIR "${PROJECT_SOURCE_DIR}/deps/libexpat"
)
else()
FetchContent_Declare(FT_libexpat
GIT_REPOSITORY https://github.com/libexpat/libexpat
GIT_TAG R_2_5_0
)
endif()
# Use FetchContent_Populate because the CMakeLists.txt is in the expat/ sub-directory
FetchContent_GetProperties(FT_libexpat)
if(NOT FT_libexpat_POPULATED)
FetchContent_Populate(FT_libexpat)
add_subdirectory("${ft_libexpat_SOURCE_DIR}/expat" ${ft_libexpat_BINARY_DIR})
endif()
set(expat_link_lib expat)
else()
include(FindEXPAT)
if(NOT EXPAT_FOUND)
message(FATAL_ERROR "expat dependency not found")
endif()
set(expat_link_lib EXPAT::EXPAT)
endif()