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
@PACKAGE_INIT@
# Transitive dependencies: when the installed library was built with
# libcurl support, CURL::libcurl appears in whiteout_lib's INTERFACE
# link libraries — re-discover it on the consumer side so the import
# resolves cleanly.
include(CMakeFindDependencyMacro)
# zlib-ng is an OPTIONAL DEFLATE backend. When WhiteoutLib was built with
# WHITEOUT_USE_ZLIBNG=ON it is a PUBLIC link dependency of whiteout_lib, so the
# imported target is rediscovered here (bundled-and-installed or system/vcpkg
# alike). When built with the in-house codec there is no such dependency.
if(@WHITEOUT_USE_ZLIBNG@)
find_dependency(zlib-ng CONFIG)
endif()
if(@CURL_FOUND@)
find_dependency(CURL)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/WhiteoutLibTargets.cmake")
# Convenience: re-export the cores under their bare names so users can
# write `target_link_libraries(app PRIVATE WhiteoutLib::whiteout_lib)`
# regardless of whether CASC / MPQ are part of this install.
set(WhiteoutLib_AVAILABLE_COMPONENTS lib)
if(TARGET WhiteoutLib::whiteout_casc)
list(APPEND WhiteoutLib_AVAILABLE_COMPONENTS casc)
endif()
if(TARGET WhiteoutLib::whiteout_mpq)
list(APPEND WhiteoutLib_AVAILABLE_COMPONENTS mpq)
endif()
# Honour `find_package(WhiteoutLib REQUIRED COMPONENTS casc mpq)`:
# if the user explicitly asked for casc/mpq but this install was built
# without them, fail loudly instead of silently providing only the core.
foreach(_comp ${WhiteoutLib_FIND_COMPONENTS})
if(NOT _comp IN_LIST WhiteoutLib_AVAILABLE_COMPONENTS)
set(WhiteoutLib_${_comp}_FOUND FALSE)
if(WhiteoutLib_FIND_REQUIRED_${_comp})
set(WhiteoutLib_FOUND FALSE)
set(WhiteoutLib_NOT_FOUND_MESSAGE
"WhiteoutLib was installed without the '${_comp}' component. "
"Available: ${WhiteoutLib_AVAILABLE_COMPONENTS}.")
return()
endif()
else()
set(WhiteoutLib_${_comp}_FOUND TRUE)
endif()
endforeach()
check_required_components(WhiteoutLib)