1# Set these variables so that the `${prefix}/lib` expands to something we can 2# remove. 3set(_harfbuzz_remove_string "REMOVE_ME") 4set(exec_prefix "${_harfbuzz_remove_string}") 5set(prefix "${_harfbuzz_remove_string}") 6 7# Compute the installation prefix by stripping components from our current 8# location. 9get_filename_component(_harfbuzz_prefix "${CMAKE_CURRENT_LIST_DIR}" DIRECTORY) 10get_filename_component(_harfbuzz_prefix "${_harfbuzz_prefix}" DIRECTORY) 11set(_harfbuzz_libdir "@libdir@") 12string(REPLACE "${_harfbuzz_remove_string}/" "" _harfbuzz_libdir "${_harfbuzz_libdir}") 13set(_harfbuzz_libdir_iter "${_harfbuzz_libdir}") 14while (_harfbuzz_libdir_iter) 15 set(_harfbuzz_libdir_prev_iter "${_harfbuzz_libdir_iter}") 16 get_filename_component(_harfbuzz_libdir_iter "${_harfbuzz_libdir_iter}" DIRECTORY) 17 if (_harfbuzz_libdir_prev_iter STREQUAL _harfbuzz_libdir_iter) 18 break() 19 endif () 20 get_filename_component(_harfbuzz_prefix "${_harfbuzz_prefix}" DIRECTORY) 21endwhile () 22unset(_harfbuzz_libdir_iter) 23 24# Get the include subdir. 25set(_harfbuzz_includedir "@includedir@") 26string(REPLACE "${_harfbuzz_remove_string}/" "" _harfbuzz_includedir "${_harfbuzz_includedir}") 27 28# Extract version information from libtool. 29set(_harfbuzz_version_info "@HB_LIBTOOL_VERSION_INFO@") 30string(REPLACE ":" ";" _harfbuzz_version_info "${_harfbuzz_version_info}") 31list(GET _harfbuzz_version_info 0 32 _harfbuzz_current) 33list(GET _harfbuzz_version_info 1 34 _harfbuzz_revision) 35list(GET _harfbuzz_version_info 2 36 _harfbuzz_age) 37unset(_harfbuzz_version_info) 38 39if (APPLE) 40 set(_harfbuzz_lib_suffix ".0${CMAKE_SHARED_LIBRARY_SUFFIX}") 41elseif (UNIX) 42 set(_harfbuzz_lib_suffix "${CMAKE_SHARED_LIBRARY_SUFFIX}.0.${_harfbuzz_current}.${_harfbuzz_revision}") 43else () 44 # Unsupported. 45 set(harfbuzz_FOUND 0) 46endif () 47 48# Add the libraries. 49add_library(harfbuzz::harfbuzz SHARED IMPORTED) 50set_target_properties(harfbuzz::harfbuzz PROPERTIES 51 INTERFACE_INCLUDE_DIRECTORIES "${_harfbuzz_prefix}/${_harfbuzz_includedir}/harfbuzz" 52 IMPORTED_LOCATION "${_harfbuzz_prefix}/${_harfbuzz_libdir}/libharfbuzz${_harfbuzz_lib_suffix}") 53 54add_library(harfbuzz::icu SHARED IMPORTED) 55set_target_properties(harfbuzz::icu PROPERTIES 56 INTERFACE_INCLUDE_DIRECTORIES "${_harfbuzz_prefix}/${_harfbuzz_includedir}/harfbuzz" 57 INTERFACE_LINK_LIBRARIES "harfbuzz::harfbuzz" 58 IMPORTED_LOCATION "${_harfbuzz_prefix}/${_harfbuzz_libdir}/libharfbuzz-icu${_harfbuzz_lib_suffix}") 59 60add_library(harfbuzz::subset SHARED IMPORTED) 61set_target_properties(harfbuzz::subset PROPERTIES 62 INTERFACE_INCLUDE_DIRECTORIES "${_harfbuzz_prefix}/${_harfbuzz_includedir}/harfbuzz" 63 INTERFACE_LINK_LIBRARIES "harfbuzz::harfbuzz" 64 IMPORTED_LOCATION "${_harfbuzz_prefix}/${_harfbuzz_libdir}/libharfbuzz-subset${_harfbuzz_lib_suffix}") 65 66# Only add the gobject library if it was built. 67set(_harfbuzz_have_gobject "@have_gobject@") 68if (_harfbuzz_have_gobject) 69 add_library(harfbuzz::gobject SHARED IMPORTED) 70 set_target_properties(harfbuzz::gobject PROPERTIES 71 INTERFACE_INCLUDE_DIRECTORIES "${_harfbuzz_prefix}/${_harfbuzz_includedir}/harfbuzz" 72 INTERFACE_LINK_LIBRARIES "harfbuzz::harfbuzz" 73 IMPORTED_LOCATION "${_harfbuzz_prefix}/${_harfbuzz_libdir}/libharfbuzz-gobject${_harfbuzz_lib_suffix}") 74endif () 75 76# Clean out variables we used in our scope. 77unset(_harfbuzz_lib_suffix) 78unset(_harfbuzz_current) 79unset(_harfbuzz_revision) 80unset(_harfbuzz_age) 81unset(_harfbuzz_includedir) 82unset(_harfbuzz_libdir) 83unset(_harfbuzz_prefix) 84unset(exec_prefix) 85unset(prefix) 86unset(_harfbuzz_remove_string) 87