build: remove libfindmacros library (#22423)

Large parts the library weren't being used, and the parts that were was overly
abstracted for our use case. Additionally, part of its use case was to abstract
pkgconfig boilerplate, which is no longer needed as pkgconfig has been removed
in favor of relying on cmake alone in 09118052ce.
This commit is contained in:
dundargoc 2023-03-02 10:22:41 +01:00 committed by GitHub
parent fb1db80f5a
commit a0292b4e5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 26 additions and 350 deletions

View File

@ -22,8 +22,9 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include(CheckCCompilerFlag) include(CheckCCompilerFlag)
include(CheckCSourceCompiles) include(CheckCSourceCompiles)
include(FindPackageHandleStandardArgs)
include(InstallHelpers) include(InstallHelpers)
include(LuaHelpers) # Find Lua interpreter include(LuaHelpers)
include(PreventInTreeBuilds) include(PreventInTreeBuilds)
include(Util) include(Util)

View File

@ -1,23 +1,8 @@
# TODO(dundargoc): FindIconv is shipped by default on cmake version 3.11+. This # TODO(dundargoc): FindIconv is shipped by default on cmake version 3.11+. This
# file can be removed once we decide to upgrade minimum cmake version. # file can be removed once we decide to upgrade minimum cmake version.
# - Try to find iconv
# Once done, this will define
#
# Iconv_FOUND - system has iconv
# Iconv_INCLUDE_DIRS - the iconv include directories
# Iconv_LIBRARIES - link these to use iconv
include(LibFindMacros)
find_path(ICONV_INCLUDE_DIR NAMES iconv.h) find_path(ICONV_INCLUDE_DIR NAMES iconv.h)
find_library(ICONV_LIBRARY NAMES iconv libiconv) find_library(ICONV_LIBRARY NAMES iconv libiconv)
find_package_handle_standard_args(Iconv DEFAULT_MSG
set(Iconv_PROCESS_INCLUDES ICONV_INCLUDE_DIR) ICONV_INCLUDE_DIR)
if(ICONV_LIBRARY) mark_as_advanced(ICONV_INCLUDE_DIR ICONV_LIBRARY)
set(Iconv_PROCESS_LIBS ICONV_LIBRARY)
endif()
libfind_process(Iconv)
mark_as_advanced(ICONV_LIBRARY)

View File

@ -1,13 +1,5 @@
# - Try to find libintl
# Once done, this will define
#
# LibIntl_FOUND - system has libintl
# LibIntl_INCLUDE_DIRS - the libintl include directories
# LibIntl_LIBRARIES - link these to use libintl
include(CheckCSourceCompiles) include(CheckCSourceCompiles)
include(CheckVariableExists) include(CheckVariableExists)
include(LibFindMacros)
# Append custom gettext path to CMAKE_PREFIX_PATH # Append custom gettext path to CMAKE_PREFIX_PATH
# if installed via Mac Homebrew # if installed via Mac Homebrew
@ -74,18 +66,15 @@ if (LibIntl_LIBRARY)
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${LibIntl_LIBRARY}") list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${LibIntl_LIBRARY}")
endif() endif()
set(REQUIRED_VARIABLES LibIntl_LIBRARY LIBTERMKEY_INCLUDE_DIR)
if (HAVE_WORKING_LIBINTL) if (HAVE_WORKING_LIBINTL)
# On some systems (linux+glibc) libintl is passively available. # On some systems (linux+glibc) libintl is passively available.
# If HAVE_WORKING_LIBINTL then we consider the requirement satisfied. # If HAVE_WORKING_LIBINTL then we consider the requirement satisfied.
# Unset REQUIRED so that libfind_process(LibIntl) can proceed. unset(REQUIRED_VARIABLES)
if(LibIntl_FIND_REQUIRED)
unset(LibIntl_FIND_REQUIRED)
endif()
set(LibIntl_FIND_QUIETLY ON)
check_variable_exists(_nl_msg_cat_cntr HAVE_NL_MSG_CAT_CNTR) check_variable_exists(_nl_msg_cat_cntr HAVE_NL_MSG_CAT_CNTR)
endif() endif()
set(LibIntl_PROCESS_INCLUDES LibIntl_INCLUDE_DIR) find_package_handle_standard_args(LibIntl DEFAULT_MSG
set(LibIntl_PROCESS_LIBS LibIntl_LIBRARY) ${REQUIRED_VARIABLES})
libfind_process(LibIntl) mark_as_advanced(LIBTERMKEY_INCLUDE_DIR LIBTERMKEY_LIBRARY)

View File

@ -8,9 +8,6 @@ find_library(LIBLUV_LIBRARY NAMES ${LIBLUV_NAMES})
set(LIBLUV_LIBRARIES ${LIBLUV_LIBRARY}) set(LIBLUV_LIBRARIES ${LIBLUV_LIBRARY})
set(LIBLUV_INCLUDE_DIRS ${LIBLUV_INCLUDE_DIR}) set(LIBLUV_INCLUDE_DIRS ${LIBLUV_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBLUV_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(LibLUV DEFAULT_MSG find_package_handle_standard_args(LibLUV DEFAULT_MSG
LIBLUV_LIBRARY LIBLUV_INCLUDE_DIR) LIBLUV_LIBRARY LIBLUV_INCLUDE_DIR)

View File

@ -1,16 +1,5 @@
find_path(LIBTERMKEY_INCLUDE_DIR termkey.h) find_path(LIBTERMKEY_INCLUDE_DIR termkey.h)
find_library(LIBTERMKEY_LIBRARY NAMES termkey)
list(APPEND LIBTERMKEY_NAMES termkey)
find_library(LIBTERMKEY_LIBRARY NAMES ${LIBTERMKEY_NAMES})
set(LIBTERMKEY_LIBRARIES ${LIBTERMKEY_LIBRARY})
set(LIBTERMKEY_INCLUDE_DIRS ${LIBTERMKEY_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBTERMKEY_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(LibTermkey DEFAULT_MSG find_package_handle_standard_args(LibTermkey DEFAULT_MSG
LIBTERMKEY_LIBRARY LIBTERMKEY_INCLUDE_DIR) LIBTERMKEY_LIBRARY LIBTERMKEY_INCLUDE_DIR)
mark_as_advanced(LIBTERMKEY_INCLUDE_DIR LIBTERMKEY_LIBRARY) mark_as_advanced(LIBTERMKEY_INCLUDE_DIR LIBTERMKEY_LIBRARY)

View File

@ -63,10 +63,6 @@ if(Threads_FOUND)
list(APPEND LIBUV_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) list(APPEND LIBUV_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
endif() endif()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBUV_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(LibUV DEFAULT_MSG find_package_handle_standard_args(LibUV DEFAULT_MSG
LIBUV_LIBRARY LIBUV_INCLUDE_DIR) LIBUV_LIBRARY LIBUV_INCLUDE_DIR)

View File

@ -14,9 +14,6 @@ find_library(LUAJIT_LIBRARY NAMES ${LUAJIT_NAMES})
set(LUAJIT_LIBRARIES ${LUAJIT_LIBRARY}) set(LUAJIT_LIBRARIES ${LUAJIT_LIBRARY})
set(LUAJIT_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIR}) set(LUAJIT_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LUAJIT_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(LuaJit DEFAULT_MSG find_package_handle_standard_args(LuaJit DEFAULT_MSG
LUAJIT_LIBRARY LUAJIT_INCLUDE_DIR) LUAJIT_LIBRARY LUAJIT_INCLUDE_DIR)

View File

@ -18,8 +18,6 @@ else()
endif() endif()
find_library(MSGPACK_LIBRARY NAMES ${MSGPACK_NAMES} find_library(MSGPACK_LIBRARY NAMES ${MSGPACK_NAMES}
# Check each directory for all names to avoid using headers/libraries from
# different places.
NAMES_PER_DIR) NAMES_PER_DIR)
mark_as_advanced(MSGPACK_INCLUDE_DIR MSGPACK_LIBRARY) mark_as_advanced(MSGPACK_INCLUDE_DIR MSGPACK_LIBRARY)
@ -27,9 +25,6 @@ mark_as_advanced(MSGPACK_INCLUDE_DIR MSGPACK_LIBRARY)
set(MSGPACK_LIBRARIES ${MSGPACK_LIBRARY}) set(MSGPACK_LIBRARIES ${MSGPACK_LIBRARY})
set(MSGPACK_INCLUDE_DIRS ${MSGPACK_INCLUDE_DIR}) set(MSGPACK_INCLUDE_DIRS ${MSGPACK_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set MSGPACK_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(Msgpack find_package_handle_standard_args(Msgpack
REQUIRED_VARS MSGPACK_LIBRARY MSGPACK_INCLUDE_DIR REQUIRED_VARS MSGPACK_LIBRARY MSGPACK_INCLUDE_DIR
VERSION_VAR MSGPACK_VERSION_STRING) VERSION_VAR MSGPACK_VERSION_STRING)

View File

@ -1,11 +1,5 @@
# - Try to find tree-sitter find_path(TreeSitter_INCLUDE_DIR tree_sitter/api.h)
# Once done, this will define find_library(TreeSitter_LIBRARY NAMES tree-sitter)
# find_package_handle_standard_args(TreeSitter DEFAULT_MSG
# TreeSitter_FOUND - system has tree-sitter TreeSitter_LIBRARY TreeSitter_INCLUDE_DIR)
# TreeSitter_INCLUDE_DIRS - the tree-sitter include directories mark_as_advanced(TreeSitter_LIBRARY TreeSitter_INCLUDE_DIR)
# TreeSitter_LIBRARIES - link these to use tree-sitter
include(LibFindMacros)
libfind_pkg_detect(TreeSitter tree-sitter FIND_PATH tree_sitter/api.h FIND_LIBRARY tree-sitter)
libfind_process(TreeSitter)

View File

@ -1,269 +0,0 @@
# Version 2.2
# Public Domain, originally written by Lasse Kärkkäinen <tronic>
# Maintained at https://github.com/Tronic/cmake-modules
# Please send your improvements as pull requests on Github.
# Find another package and make it a dependency of the current package.
# This also automatically forwards the "REQUIRED" argument.
# Usage: libfind_package(<prefix> <another package> [extra args to find_package])
macro (libfind_package PREFIX PKG)
set(${PREFIX}_args ${PKG} ${ARGN})
if (${PREFIX}_FIND_REQUIRED)
set(${PREFIX}_args ${${PREFIX}_args} REQUIRED)
endif()
find_package(${${PREFIX}_args})
set(${PREFIX}_DEPENDENCIES ${${PREFIX}_DEPENDENCIES};${PKG})
unset(${PREFIX}_args)
endmacro()
# A simple wrapper to make pkg-config searches a bit easier.
# Works the same as CMake's internal pkg_check_modules but is always quiet.
macro (libfind_pkg_check_modules)
find_package(PkgConfig QUIET)
if (PKG_CONFIG_FOUND)
pkg_check_modules(${ARGN} QUIET)
endif()
endmacro()
# Avoid useless copy&pasta by doing what most simple libraries do anyway:
# pkg-config, find headers, find library.
# Usage: libfind_pkg_detect(<prefix> <pkg-config args> FIND_PATH <name> [other args] FIND_LIBRARY <name> [other args])
# E.g. libfind_pkg_detect(SDL2 sdl2 FIND_PATH SDL.h PATH_SUFFIXES SDL2 FIND_LIBRARY SDL2)
function (libfind_pkg_detect PREFIX)
# Parse arguments
set(argname pkgargs)
foreach (i ${ARGN})
if ("${i}" STREQUAL "FIND_PATH")
set(argname pathargs)
elseif ("${i}" STREQUAL "FIND_LIBRARY")
set(argname libraryargs)
else()
set(${argname} ${${argname}} ${i})
endif()
endforeach()
if (NOT pkgargs)
message(FATAL_ERROR "libfind_pkg_detect requires at least a pkg_config package name to be passed.")
endif()
# Find library
libfind_pkg_check_modules(${PREFIX}_PKGCONF ${pkgargs})
if (pathargs)
find_path(${PREFIX}_INCLUDE_DIR NAMES ${pathargs} HINTS ${${PREFIX}_PKGCONF_INCLUDE_DIRS})
endif()
if (libraryargs)
find_library(${PREFIX}_LIBRARY NAMES ${libraryargs} HINTS ${${PREFIX}_PKGCONF_LIBRARY_DIRS})
endif()
# Read pkg-config version
if (${PREFIX}_PKGCONF_VERSION)
set(${PREFIX}_VERSION ${${PREFIX}_PKGCONF_VERSION} PARENT_SCOPE)
endif()
endfunction()
# Extracts a version #define from a version.h file, output stored to <PREFIX>_VERSION.
# Usage: libfind_version_header(Foobar foobar/version.h FOOBAR_VERSION_STR)
# Fourth argument "QUIET" may be used for silently testing different define names.
# This function does nothing if the version variable is already defined.
function (libfind_version_header PREFIX VERSION_H DEFINE_NAME)
# Skip processing if we already have a version or if the include dir was not found
if (${PREFIX}_VERSION OR NOT ${PREFIX}_INCLUDE_DIR)
return()
endif()
set(quiet ${${PREFIX}_FIND_QUIETLY})
# Process optional arguments
foreach(arg ${ARGN})
if (arg STREQUAL "QUIET")
set(quiet TRUE)
else()
message(AUTHOR_WARNING "Unknown argument ${arg} to libfind_version_header ignored.")
endif()
endforeach()
# Read the header and parse for version number
set(filename "${${PREFIX}_INCLUDE_DIR}/${VERSION_H}")
if (NOT EXISTS ${filename})
if (NOT quiet)
message(AUTHOR_WARNING "Unable to find ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}")
endif()
return()
endif()
file(READ "${filename}" header)
string(REGEX REPLACE ".*#[ \t]*define[ \t]*${DEFINE_NAME}[ \t]*\"([^\n]*)\".*" "\\1" match "${header}")
# No regex match?
if (match STREQUAL header)
if (NOT quiet)
message(AUTHOR_WARNING "Unable to find \#define ${DEFINE_NAME} \"<version>\" from ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}")
endif()
return()
endif()
# Export the version string
set(${PREFIX}_VERSION "${match}" PARENT_SCOPE)
endfunction()
# Do the final processing once the paths have been detected.
# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain
# all the variables, each of which contain one include directory.
# Ditto for ${PREFIX}_PROCESS_LIBS and library files.
# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES.
# Also handles errors in case library detection was required, etc.
function (libfind_process PREFIX)
# Skip processing if already processed during this configuration run
if (${PREFIX}_FOUND)
return()
endif()
set(found TRUE) # Start with the assumption that the package was found
# Did we find any files? Did we miss includes? These are for formatting better error messages.
set(some_files FALSE)
set(missing_headers FALSE)
# Shorthands for some variables that we need often
set(quiet ${${PREFIX}_FIND_QUIETLY})
set(required ${${PREFIX}_FIND_REQUIRED})
set(exactver ${${PREFIX}_FIND_VERSION_EXACT})
set(findver "${${PREFIX}_FIND_VERSION}")
set(version "${${PREFIX}_VERSION}")
# Lists of config option names (all, includes, libs)
unset(configopts)
set(includeopts ${${PREFIX}_PROCESS_INCLUDES})
set(libraryopts ${${PREFIX}_PROCESS_LIBS})
# Process deps to add to
foreach (i ${PREFIX} ${${PREFIX}_DEPENDENCIES})
if (DEFINED ${i}_INCLUDE_OPTS OR DEFINED ${i}_LIBRARY_OPTS)
# The package seems to export option lists that we can use, woohoo!
list(APPEND includeopts ${${i}_INCLUDE_OPTS})
list(APPEND libraryopts ${${i}_LIBRARY_OPTS})
else()
# If plural forms don't exist or they equal singular forms
if ((NOT DEFINED ${i}_INCLUDE_DIRS AND NOT DEFINED ${i}_LIBRARIES) OR
(${i}_INCLUDE_DIR STREQUAL ${i}_INCLUDE_DIRS AND ${i}_LIBRARY STREQUAL ${i}_LIBRARIES))
# Singular forms can be used
if (DEFINED ${i}_INCLUDE_DIR)
list(APPEND includeopts ${i}_INCLUDE_DIR)
endif()
if (DEFINED ${i}_LIBRARY)
list(APPEND libraryopts ${i}_LIBRARY)
endif()
else()
# Oh no, we don't know the option names
message(FATAL_ERROR "We couldn't determine config variable names for ${i} includes and libs. Aieeh!")
endif()
endif()
endforeach()
if (includeopts)
list(REMOVE_DUPLICATES includeopts)
endif()
if (libraryopts)
list(REMOVE_DUPLICATES libraryopts)
endif()
string(REGEX REPLACE ".*[ ;]([^ ;]*(_INCLUDE_DIRS|_LIBRARIES))" "\\1" tmp "${includeopts} ${libraryopts}")
if (NOT tmp STREQUAL "${includeopts} ${libraryopts}")
message(AUTHOR_WARNING "Plural form ${tmp} found in config options of ${PREFIX}. This works as before but is now deprecated. Please only use singular forms INCLUDE_DIR and LIBRARY, and update your find scripts for LibFindMacros > 2.0 automatic dependency system (most often you can simply remove the PROCESS variables entirely).")
endif()
# Include/library names separated by spaces (notice: not CMake lists)
unset(includes)
unset(libs)
# Process all includes and set found false if any are missing
foreach (i ${includeopts})
list(APPEND configopts ${i})
if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND")
list(APPEND includes "${${i}}")
else()
set(found FALSE)
set(missing_headers TRUE)
endif()
endforeach()
# Process all libraries and set found false if any are missing
foreach (i ${libraryopts})
list(APPEND configopts ${i})
if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND")
list(APPEND libs "${${i}}")
else()
set (found FALSE)
endif()
endforeach()
# Version checks
if (found AND findver)
if (NOT version)
message(WARNING "The find module for ${PREFIX} does not provide version information, so we'll just assume that it is OK. Please fix the module or remove package version requirements to get rid of this warning.")
elseif (version VERSION_LESS findver OR (exactver AND NOT version VERSION_EQUAL findver))
set(found FALSE)
set(version_unsuitable TRUE)
endif()
endif()
# If all-OK, hide all config options, export variables, print status and exit
if (found)
foreach (i ${configopts})
mark_as_advanced(${i})
endforeach()
if (NOT quiet)
message(STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}")
if (LIBFIND_DEBUG)
message(STATUS " ${PREFIX}_DEPENDENCIES=${${PREFIX}_DEPENDENCIES}")
message(STATUS " ${PREFIX}_INCLUDE_OPTS=${includeopts}")
message(STATUS " ${PREFIX}_INCLUDE_DIRS=${includes}")
message(STATUS " ${PREFIX}_LIBRARY_OPTS=${libraryopts}")
message(STATUS " ${PREFIX}_LIBRARIES=${libs}")
endif()
endif()
set (${PREFIX}_INCLUDE_OPTS ${includeopts} PARENT_SCOPE)
set (${PREFIX}_LIBRARY_OPTS ${libraryopts} PARENT_SCOPE)
set (${PREFIX}_INCLUDE_DIRS ${includes} PARENT_SCOPE)
set (${PREFIX}_LIBRARIES ${libs} PARENT_SCOPE)
set (${PREFIX}_FOUND TRUE PARENT_SCOPE)
return()
endif()
# Format messages for debug info and the type of error
set(vars "Relevant CMake configuration variables:\n")
foreach (i ${configopts})
mark_as_advanced(CLEAR ${i})
set(val ${${i}})
if ("${val}" STREQUAL "${i}-NOTFOUND")
set (val "<not found>")
elseif (val AND NOT EXISTS ${val})
set (val "${val} (does not exist)")
else()
set(some_files TRUE)
endif()
set(vars "${vars} ${i}=${val}\n")
endforeach()
set(vars "${vars}You may use CMake GUI, cmake -D or ccmake to modify the values. Delete CMakeCache.txt to discard all values and force full re-detection if necessary.\n")
if (version_unsuitable)
set(msg "${PREFIX} ${${PREFIX}_VERSION} was found but")
if (exactver)
set(msg "${msg} only version ${findver} is acceptable.")
else()
set(msg "${msg} version ${findver} is the minimum requirement.")
endif()
else()
if (missing_headers)
set(msg "We could not find development headers for ${PREFIX}. Do you have the necessary dev package installed?")
elseif (some_files)
set(msg "We only found some files of ${PREFIX}, not all of them. Perhaps your installation is incomplete or maybe we just didn't look in the right place?")
if(findver)
set(msg "${msg} This could also be caused by incompatible version (if it helps, at least ${PREFIX} ${findver} should work).")
endif()
else()
set(msg "We were unable to find package ${PREFIX}.")
endif()
endif()
# Fatal error out if REQUIRED
if (required)
set(msg "REQUIRED PACKAGE NOT FOUND\n${msg} This package is REQUIRED and you need to install it or adjust CMake configuration in order to continue building ${CMAKE_PROJECT_NAME}.")
message(FATAL_ERROR "${msg}\n${vars}")
endif()
# Otherwise just print a nasty warning
if (NOT quiet)
message(WARNING "WARNING: MISSING PACKAGE\n${msg} This package is NOT REQUIRED and you may ignore this warning but by doing so you may miss some functionality of ${CMAKE_PROJECT_NAME}. \n${vars}")
endif()
endfunction()

View File

@ -25,29 +25,31 @@ set_target_properties(luv PROPERTIES IMPORTED_LOCATION ${LIBLUV_LIBRARIES})
target_link_libraries(main_lib INTERFACE luv) target_link_libraries(main_lib INTERFACE luv)
find_package(TreeSitter REQUIRED) find_package(TreeSitter REQUIRED)
target_include_directories(main_lib SYSTEM BEFORE INTERFACE ${TreeSitter_INCLUDE_DIRS}) target_include_directories(main_lib SYSTEM BEFORE INTERFACE ${TreeSitter_INCLUDE_DIR})
target_link_libraries(main_lib INTERFACE ${TreeSitter_LIBRARIES}) target_link_libraries(main_lib INTERFACE ${TreeSitter_LIBRARY})
find_package(unibilium 2.0 REQUIRED) find_package(unibilium 2.0 REQUIRED)
target_link_libraries(main_lib INTERFACE unibilium) target_link_libraries(main_lib INTERFACE unibilium)
find_package(LibTermkey 0.22 REQUIRED) find_package(LibTermkey 0.22 REQUIRED)
target_include_directories(main_lib SYSTEM BEFORE INTERFACE ${LIBTERMKEY_INCLUDE_DIRS}) target_include_directories(main_lib SYSTEM BEFORE INTERFACE ${LIBTERMKEY_INCLUDE_DIR})
target_link_libraries(main_lib INTERFACE ${LIBTERMKEY_LIBRARIES}) target_link_libraries(main_lib INTERFACE ${LIBTERMKEY_LIBRARY})
find_package(libvterm 0.3 REQUIRED) find_package(libvterm 0.3 REQUIRED)
target_link_libraries(main_lib INTERFACE libvterm) target_link_libraries(main_lib INTERFACE libvterm)
find_package(Iconv REQUIRED) find_package(Iconv REQUIRED)
target_include_directories(main_lib SYSTEM BEFORE INTERFACE ${Iconv_INCLUDE_DIRS}) target_include_directories(main_lib SYSTEM BEFORE INTERFACE ${ICONV_INCLUDE_DIR})
target_link_libraries(main_lib INTERFACE ${Iconv_LIBRARIES}) if(ICONV_LIBRARY)
target_link_libraries(main_lib INTERFACE ${ICONV_LIBRARY})
endif()
option(ENABLE_LIBINTL "enable libintl" ON) option(ENABLE_LIBINTL "enable libintl" ON)
if(ENABLE_LIBINTL) if(ENABLE_LIBINTL)
# LibIntl (not Intl) selects our FindLibIntl.cmake script. #8464 # LibIntl (not Intl) selects our FindLibIntl.cmake script. #8464
find_package(LibIntl REQUIRED) find_package(LibIntl REQUIRED)
target_include_directories(main_lib SYSTEM BEFORE INTERFACE ${LibIntl_INCLUDE_DIRS}) target_include_directories(main_lib SYSTEM BEFORE INTERFACE ${LibIntl_INCLUDE_DIR})
if (LibIntl_FOUND) if (LibIntl_LIBRARY)
target_link_libraries(main_lib INTERFACE ${LibIntl_LIBRARY}) target_link_libraries(main_lib INTERFACE ${LibIntl_LIBRARY})
endif() endif()
endif() endif()