Skip to content

Commit

Permalink
include and link to utf8proc
Browse files Browse the repository at this point in the history
  • Loading branch information
ennorehling committed Dec 3, 2022
1 parent 94cdae0 commit 2507aca
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ endif (NOT CURSES_FOUND)

find_package (EXPAT REQUIRED)
find_package (Lua 5.2 REQUIRED)
find_package (Utf8Proc REQUIRED)

find_library(SQLITE3_LIBRARY sqlite3 REQUIRED)
find_path(SQLITE3_INCLUDE_DIR NAMES sqlite3.h REQUIRED)
Expand Down
60 changes: 60 additions & 0 deletions cmake/Modules/FindUtf8Proc.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#.rst:
# FindUtf8Proc
# --------
#
# Find utf8proc
#
# Find the UTF-8 processing library
#
# ::
#
# This module defines the following variables:
# UTF8PROC_FOUND - True if UTF8PROC_INCLUDE_DIR & UTF8PROC_LIBRARY are found
# UTF8PROC_LIBRARIES - Set when UTF8PROC_LIBRARY is found
# UTF8PROC_INCLUDE_DIRS - Set when UTF8PROC_INCLUDE_DIR is found
#
#
#
# ::
#
# UTF8PROC_INCLUDE_DIR - where to find utf8proc.h
# UTF8PROC_LIBRARY - the utf8proc library

#=============================================================================
# This module is adapted from FindALSA.cmake. Below are the original license
# header.
#=============================================================================
# Copyright 2009-2011 Kitware, Inc.
# Copyright 2009-2011 Philip Lowman <philip@yhbt.com>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================

find_path(
UTF8PROC_INCLUDE_DIR NAMES utf8proc.h DOC "The utf8proc include directory"
)

find_library(
UTF8PROC_LIBRARY NAMES utf8proc DOC "The utf8proc library"
)

# handle the QUIETLY and REQUIRED arguments and set UTF8PROC_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
Utf8Proc
FOUND_VAR Utf8Proc_FOUND
REQUIRED_VARS UTF8PROC_LIBRARY UTF8PROC_INCLUDE_DIR
)

if(Utf8Proc_FOUND)
set( UTF8PROC_LIBRARIES ${UTF8PROC_LIBRARY} )
set( UTF8PROC_INCLUDE_DIRS ${UTF8PROC_INCLUDE_DIR} )
endif()

mark_as_advanced(UTF8PROC_INCLUDE_DIR UTF8PROC_LIBRARY)
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ endif (HAVE_LIBM)

add_library(game ${ERESSEA_SRC})
target_include_directories (game PUBLIC ${INIPARSER_INCLUDE_DIR})
target_include_directories (game PUBLIC ${UTF8PROC_INCLUDE_DIR})
target_link_libraries(game ${EXTRA_LIBS} parser version)

add_executable(eressea ${SERVER_SRC})
Expand All @@ -204,6 +205,7 @@ target_link_libraries(eressea
${STORAGE_LIBRARIES}
${CJSON_LIBRARY}
${INIPARSER_LIBRARY}
${UTF8PROC_LIBRARY}
)

add_test(NAME lua-core
Expand Down Expand Up @@ -288,6 +290,7 @@ target_link_libraries(test_eressea
${STORAGE_LIBRARIES}
${CJSON_LIBRARY}
${INIPARSER_LIBRARY}
${UTF8PROC_LIBRARY}
)

set_target_properties(test_eressea eressea PROPERTIES C_STANDARD 90)
Expand Down Expand Up @@ -324,6 +327,7 @@ endif (HAVE_LIBBSD)

target_include_directories (game PUBLIC ${CJSON_INCLUDE_DIR})
target_include_directories (game PUBLIC ${INIPARSER_INCLUDE_DIR})
target_include_directories (game PUBLIC ${UTF8PROC_INCLUDE_DIR})

target_include_directories (game PRIVATE ${SQLITE3_INCLUDE_DIR})
target_link_libraries(eressea ${SQLITE3_LIBRARY})
Expand Down

0 comments on commit 2507aca

Please sign in to comment.