mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-22 00:06:12 -05:00
[poly2tri] modernize with using a cmake target
This commit is contained in:
parent
7f1ba1c48e
commit
b111d71f0e
@ -398,7 +398,7 @@ if(WITH_CORE)
|
||||
endif()
|
||||
|
||||
if (NOT WITH_INTERNAL_POLY2TRI)
|
||||
find_package(Poly2Tri REQUIRED)
|
||||
find_package(poly2tri REQUIRED)
|
||||
endif()
|
||||
|
||||
if (WITH_SPATIALITE)
|
||||
|
@ -1,24 +0,0 @@
|
||||
# Find Poly2Tri
|
||||
# ~~~~~~~~~
|
||||
# Copyright (c) 2020, Peter Petrik <zilolv at gmail dot com>
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
#
|
||||
#
|
||||
# Once run this will define:
|
||||
# Poly2Tri_FOUND - System has Poly2Tri
|
||||
# Poly2Tri_INCLUDE_DIR - The Poly2Tri include directory
|
||||
# Poly2Tri_LIBRARY - The library needed to use Poly2Tri
|
||||
|
||||
find_path(Poly2Tri_INCLUDE_DIR poly2tri.h
|
||||
HINTS $ENV{LIB_DIR}/include)
|
||||
|
||||
find_library(Poly2Tri_LIBRARY NAMES poly2tri libpoly2tri
|
||||
HINTS $ENV{LIB_DIR}/lib)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(Poly2Tri DEFAULT_MSG
|
||||
Poly2Tri_LIBRARY Poly2Tri_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced( Poly2Tri_INCLUDE_DIR Poly2Tri_LIBRARY )
|
31
cmake/Findpoly2tri.cmake
Normal file
31
cmake/Findpoly2tri.cmake
Normal file
@ -0,0 +1,31 @@
|
||||
# Find poly2tri
|
||||
# ~~~~~~~~~~~~~
|
||||
# Copyright (c) 2020, Peter Petrik <zilolv at gmail dot com>
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
#
|
||||
#
|
||||
# Once run this will define:
|
||||
# poly2tri_FOUND - System has poly2tri
|
||||
# poly2tri::poly2tri - Target
|
||||
|
||||
find_package(poly2tri CONFIG)
|
||||
if(NOT poly2tri_FOUND)
|
||||
find_path(poly2tri_INCLUDE_DIR poly2tri.h
|
||||
HINTS $ENV{LIB_DIR}/include)
|
||||
|
||||
find_library(poly2tri_LIBRARY NAMES poly2tri libpoly2tri
|
||||
HINTS $ENV{LIB_DIR}/lib)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(poly2tri DEFAULT_MSG
|
||||
poly2tri_LIBRARY poly2tri_INCLUDE_DIR)
|
||||
|
||||
|
||||
add_library(poly2tri::poly2tri UNKNOWN IMPORTED)
|
||||
target_link_libraries(poly2tri::poly2tri INTERFACE ${poly2tri_LIBRARY})
|
||||
target_include_directories(poly2tri::poly2tri INTERFACE ${poly2tri_INCLUDE_DIR})
|
||||
set_target_properties(poly2tri::poly2tri PROPERTIES IMPORTED_LOCATION ${poly2tri_LIBRARY})
|
||||
mark_as_advanced(poly2tri_INCLUDE_DIR poly2tri_LIBRARY)
|
||||
endif()
|
@ -973,8 +973,6 @@ if (WITH_INTERNAL_POLY2TRI)
|
||||
${CMAKE_SOURCE_DIR}/external/poly2tri/sweep/sweep.cc
|
||||
)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/external/poly2tri)
|
||||
else ()
|
||||
include_directories(${Poly2Tri_INCLUDE_DIR})
|
||||
endif ()
|
||||
|
||||
file(GLOB JSON_HELP_FILES "${CMAKE_SOURCE_DIR}/resources/function_help/json/*")
|
||||
@ -2347,7 +2345,7 @@ if(ENABLE_MODELTEST)
|
||||
endif()
|
||||
|
||||
if (NOT WITH_INTERNAL_POLY2TRI)
|
||||
target_link_libraries(qgis_core ${Poly2Tri_LIBRARY})
|
||||
target_link_libraries(qgis_core poly2tri::poly2tri)
|
||||
endif()
|
||||
|
||||
if(HAVE_OPENCL)
|
||||
|
Loading…
x
Reference in New Issue
Block a user