From 59d2f21369e5c8a327ebc6519b6e2da3241ae2f8 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 22 Apr 2022 15:10:02 +0200 Subject: [PATCH] [CMake] remove FindCairo and use pkgconfig --- CMakeLists.txt | 14 +------ cmake/FindCairo.cmake | 98 ------------------------------------------- 2 files changed, 2 insertions(+), 110 deletions(-) delete mode 100644 cmake/FindCairo.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e77bc927..0f8148fc0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -302,13 +302,8 @@ if(USE_WEBP) endif() if(USE_CAIRO) - if(WIN32) - mapnik_find_package(Cairo REQUIRED) - list(APPEND MAPNIK_OPTIONAL_LIBS Cairo::Cairo) - else() - pkg_check_modules(Cairo REQUIRED IMPORTED_TARGET cairo) - list(APPEND MAPNIK_OPTIONAL_LIBS PkgConfig::Cairo) - endif() + pkg_check_modules(Cairo REQUIRED IMPORTED_TARGET cairo) + list(APPEND MAPNIK_OPTIONAL_LIBS PkgConfig::Cairo) list(APPEND MAPNIK_COMPILE_DEFS HAVE_CAIRO) endif() @@ -364,11 +359,6 @@ add_compile_options( "$<$:/utf-8>" "$<$:/EHsc>" ) -if(BUILD_SHARED_CRT) - set_property(GLOBAL PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") -else() - set_property(GLOBAL PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") -endif() add_library(core INTERFACE) add_library(mapnik::core ALIAS core) diff --git a/cmake/FindCairo.cmake b/cmake/FindCairo.cmake deleted file mode 100644 index 1dc42a6a0..000000000 --- a/cmake/FindCairo.cmake +++ /dev/null @@ -1,98 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#[=======================================================================[.rst: -FindCairo ------------ - -Find Cairo 2D graphics library. - - -Imported Targets -^^^^^^^^^^^^^^^^ -This module defines :prop_tgt:`IMPORTED` target ``Cairo::Cairo``, if -cairo has been found. - -Result variables -^^^^^^^^^^^^^^^^ - -This module will set the following variables in your project: - -``CAIRO_FOUND`` - True if cairo headers and library were found. -``CAIRO_INCLUDE_DIRS`` - Directory where cairo headers are located. -``CAIRO_LIBRARIES`` - cairo libraries to link against. -``CAIRO_VERSION_MAJOR`` - The major version of cairo -``CAIRO_VERSION_MINOR`` - The minor version of cairo -``CAIRO_VERSION_PATCH`` - The patch version of cairo -``CAIRO_VERSION_STRING`` - version number as a string (ex: "1.16.0") -#]=======================================================================] - -if(NOT CAIRO_LIBRARY) - find_path(CAIRO_INCLUDE_DIR NAMES cairo.h HINTS ${PC_CAIRO_INCLUDEDIR} ${PC_CAIRO_INCLUDE_DIR} PATH_SUFFIXES cairo) - find_library(CAIRO_LIBRARY_RELEASE NAMES ${Cairo_NAMES} cairo HINTS ${PC_CAIRO_LIBDIR} ${PC_CAIRO_LIBRARY_DIRS}) - find_library(CAIRO_LIBRARY_DEBUG NAMES ${Cairo_NAMES} cairod HINTS ${PC_CAIRO_LIBDIR} ${PC_CAIRO_LIBRARY_DIRS}) - include(SelectLibraryConfigurations) - select_library_configurations(CAIRO) -else() - file(TO_CMAKE_PATH "${CAIRO_LIBRARY}" CAIRO_LIBRARY) -endif() - -if(CAIRO_INCLUDE_DIR AND NOT CAIRO_VERSION) - if(EXISTS "${CAIRO_INCLUDE_DIR}/cairo-version.h") - file(READ "${CAIRO_INCLUDE_DIR}/cairo-version.h" CAIRO_VERSION_CONTENT) - - string(REGEX MATCH "#define +CAIRO_VERSION_MAJOR +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}") - set(CAIRO_VERSION_MAJOR "${CMAKE_MATCH_1}") - - string(REGEX MATCH "#define +CAIRO_VERSION_MINOR +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}") - set(CAIRO_VERSION_MINOR "${CMAKE_MATCH_1}") - - string(REGEX MATCH "#define +CAIRO_VERSION_MICRO +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}") - set(CAIRO_VERSION_PATCH "${CMAKE_MATCH_1}") - - set(CAIRO_VERSION "${CAIRO_VERSION_MAJOR}.${CAIRO_VERSION_MINOR}.${CAIRO_VERSION_PATCH}") - set(CAIRO_VERSION_STRING ${CAIRO_VERSION}) - endif() -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Cairo - REQUIRED_VARS - CAIRO_LIBRARY - CAIRO_INCLUDE_DIR - VERSION_VAR - CAIRO_VERSION_STRING -) -mark_as_advanced(CAIRO_INCLUDE_DIR CAIRO_LIBRARY) - -if (CAIRO_FOUND) - set(CAIRO_LIBRARIES ${CAIRO_LIBRARY}) - set(CAIRO_INCLUDE_DIRS ${CAIRO_INCLUDE_DIR}) - if(NOT TARGET Cairo::Cairo) - add_library(Cairo::Cairo UNKNOWN IMPORTED) - set_target_properties(Cairo::Cairo PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES ${CAIRO_INCLUDE_DIR} - IMPORTED_LINK_INTERFACE_LANGUAGES C) - - if(CAIRO_LIBRARY_RELEASE) - set_property(TARGET Cairo::Cairo APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) - set_target_properties(Cairo::Cairo PROPERTIES IMPORTED_LOCATION_RELEASE "${CAIRO_LIBRARY_RELEASE}") - endif() - - if(CAIRO_LIBRARY_DEBUG) - set_property(TARGET Cairo::Cairo APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) - set_target_properties(Cairo::Cairo PROPERTIES IMPORTED_LOCATION_DEBUG "${CAIRO_LIBRARY_DEBUG}") - endif() - - if(NOT CAIRO_LIBRARY_RELEASE AND NOT CAIRO_LIBRARY_DEBUG) - set_target_properties(Cairo::Cairo PROPERTIES IMPORTED_LOCATION "${CAIRO_LIBRARY}") - endif() - endif() -endif ()