mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-14 03:58:18 +00:00
52e42c2f74
This makes CMake look at the provided libraries before considering system libraries. Enable this by default on Windows. Fixes #830.
31 lines
1 KiB
CMake
31 lines
1 KiB
CMake
find_package(PkgConfig QUIET)
|
|
pkg_check_modules(PC_FREETYPE freetype2)
|
|
set_extra_dirs(FREETYPE freetype)
|
|
|
|
find_path(FREETYPE_INCLUDEDIR
|
|
NAMES config/ftheader.h freetype/config/ftheader.h
|
|
PATH_SUFFIXES freetype2
|
|
HINTS ${HINTS_FREETYPE_INCLUDEDIR} ${PC_FREETYPE_INCLUDEDIR} ${PC_FREETYPE_INCLUDE_DIRS}
|
|
PATHS ${PATHS_FREETYPE_INCLUDEDIR}
|
|
)
|
|
find_library(FREETYPE_LIBRARY
|
|
NAMES freetype
|
|
HINTS ${HINTS_FREETYPE_LIBDIR} ${PC_FREETYPE_LIBDIR} ${PC_FREETYPE_LIBRARY_DIRS}
|
|
PATHS ${PATHS_FREETYPE_LIBDIR}
|
|
)
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
find_package_handle_standard_args(Freetype DEFAULT_MSG FREETYPE_LIBRARY FREETYPE_INCLUDEDIR)
|
|
|
|
mark_as_advanced(FREETYPE_LIBRARY FREETYPE_INCLUDEDIR)
|
|
|
|
set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY})
|
|
set(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDEDIR})
|
|
|
|
string(FIND "${FREETYPE_LIBRARY}" "${PROJECT_SOURCE_DIR}" LOCAL_PATH_POS)
|
|
if(LOCAL_PATH_POS EQUAL 0 AND TARGET_OS STREQUAL "windows")
|
|
set(FREETYPE_COPY_FILES "${EXTRA_FREETYPE_LIBDIR}/libfreetype.dll")
|
|
else()
|
|
set(FREETYPE_COPY_FILES)
|
|
endif()
|