-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
129 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,107 @@ | ||
# - Try to find RESVG | ||
# Once done this will define | ||
# RESVG_FOUND - System has RESVG | ||
# RESVG_INCLUDE_DIRS - The RESVG include directories | ||
# RESVG_LIBRARIES - The libraries needed to use RESVG | ||
find_path ( RESVG_INCLUDE_DIR ResvgQt.h | ||
PATHS ${RESVGDIR}/include/resvg | ||
$ENV{RESVGDIR}/include/resvg | ||
$ENV{RESVGDIR}/include | ||
/usr/include/resvg | ||
/usr/include | ||
/usr/local/include/resvg | ||
/usr/local/include ) | ||
|
||
find_library ( RESVG_LIBRARY NAMES resvg | ||
PATHS /usr/lib | ||
/usr/local/lib | ||
$ENV{RESVGDIR} | ||
$ENV{RESVGDIR}/lib ) | ||
|
||
set ( RESVG_LIBRARIES ${RESVG_LIBRARY} ) | ||
set ( RESVG_INCLUDE_DIRS ${RESVG_INCLUDE_DIR} ) | ||
|
||
include ( FindPackageHandleStandardArgs ) | ||
# handle the QUIETLY and REQUIRED arguments and set RESVG_FOUND to TRUE | ||
# if all listed variables are TRUE | ||
find_package_handle_standard_args ( RESVG "Could NOT find RESVG, using Qt SVG parsing instead" RESVG_LIBRARY RESVG_INCLUDE_DIR ) | ||
mark_as_advanced( RESVG_LIBRARY RESVG_INCLUDE_DIR ) | ||
# vim: ts=2 sw=2 | ||
#[=======================================================================[.rst: | ||
FindRESVG | ||
--------- | ||
Try to find the shared-library build of resvg, the Rust SVG library | ||
IMPORTED targets | ||
^^^^^^^^^^^^^^^^ | ||
This module defines :prop_tgt:`IMPORTED` target ``RESVG::resvg`` when | ||
the library and headers are found. | ||
Result Variables | ||
^^^^^^^^^^^^^^^^ | ||
This module defines the following variables: | ||
:: | ||
RESVG_FOUND - Library and header files found | ||
RESVG_INCLUDE_DIRS - Include directory path | ||
RESVG_LIBRARIES - Link path to the library | ||
RESVG_DEFINITIONS - Compiler switches (currently unused) | ||
Backwards compatibility | ||
^^^^^^^^^^^^^^^^^^^^^^^ | ||
For compatibility with previous versions of this module, uppercase names | ||
for FFmpeg and for all components are also recognized, and all-uppercase | ||
versions of the cache variables are also created. | ||
Control variables | ||
^^^^^^^^^^^^^^^^^ | ||
The following variables can be used to provide path hints to the module: | ||
RESVGDIR - Set in the calling CMakeLists.txt or on the command line | ||
ENV{RESVGDIR} - An environment variable in the cmake process context | ||
Copyright (c) 2020, FeRD (Frank Dana) <[email protected]> | ||
#]=======================================================================] | ||
include(FindPackageHandleStandardArgs) | ||
|
||
# CMake 3.4+ only: Convert relative paths to absolute | ||
if(DEFINED RESVGDIR AND CMAKE_VERSION VERSION_GREATER 3.4) | ||
get_filename_component(RESVGDIR "${RESVGDIR}" ABSOLUTE | ||
BASE_DIR ${CMAKE_CURRENT_BINARY_DIR}) | ||
endif() | ||
|
||
find_path(RESVG_INCLUDE_DIRS | ||
ResvgQt.h | ||
PATHS | ||
${RESVGDIR} | ||
${RESVGDIR}/include | ||
$ENV{RESVGDIR} | ||
$ENV{RESVGDIR}/include | ||
/usr/include | ||
/usr/local/include | ||
PATH_SUFFIXES | ||
resvg | ||
capi/include | ||
resvg/capi/include | ||
) | ||
|
||
find_library(RESVG_LIBRARIES | ||
NAMES resvg | ||
PATHS | ||
${RESVGDIR} | ||
${RESVGDIR}/lib | ||
$ENV{RESVGDIR} | ||
$ENV{RESVGDIR}/lib | ||
/usr/lib | ||
/usr/local/lib | ||
PATH_SUFFIXES | ||
resvg | ||
target/release | ||
resvg/target/release | ||
) | ||
|
||
if (RESVG_INCLUDE_DIRS AND RESVG_LIBRARIES) | ||
set(RESVG_FOUND TRUE) | ||
endif() | ||
set(RESVG_LIBRARIES ${RESVG_LIBRARIES} CACHE STRING "The Resvg library link path") | ||
set(RESVG_INCLUDE_DIRS ${RESVG_INCLUDE_DIRS} CACHE STRING "The Resvg include directories") | ||
set(RESVG_DEFINITIONS "" CACHE STRING "The Resvg CFLAGS") | ||
|
||
mark_as_advanced(RESVG_LIBRARIES RESVG_INCLUDE_DIRS RESVG_DEFINITIONS) | ||
|
||
# Give a nice error message if some of the required vars are missing. | ||
find_package_handle_standard_args(RESVG | ||
"Could NOT find RESVG, using Qt SVG parsing instead" | ||
RESVG_LIBRARIES RESVG_INCLUDE_DIRS ) | ||
|
||
# Export target | ||
if(RESVG_FOUND AND NOT TARGET RESVG::resvg) | ||
message(STATUS "Creating IMPORTED target RESVG::resvg") | ||
add_library(RESVG::resvg UNKNOWN IMPORTED) | ||
|
||
set_target_properties(RESVG::resvg PROPERTIES | ||
INTERFACE_INCLUDE_DIRECTORIES "${RESVG_INCLUDE_DIRS}") | ||
|
||
set_property(TARGET RESVG::resvg APPEND PROPERTY | ||
INTERFACE_COMPILE_DEFINITIONS "${RESVG_DEFINITIONS}") | ||
|
||
set_property(TARGET RESVG::resvg APPEND PROPERTY | ||
IMPORTED_LOCATION "${RESVG_LIBRARIES}") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters