Поиск Proj и GeographicLib
This commit is contained in:
		
							
								
								
									
										40
									
								
								FindGeographicLib.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								FindGeographicLib.cmake
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
				
			|||||||
 | 
					# Look for GeographicLib
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Set
 | 
				
			||||||
 | 
					#  GeographicLib_FOUND = GEOGRAPHICLIB_FOUND = TRUE
 | 
				
			||||||
 | 
					#  GeographicLib_INCLUDE_DIRS = /usr/local/include
 | 
				
			||||||
 | 
					#  GeographicLib_LIBRARIES = /usr/local/lib/libGeographic.so
 | 
				
			||||||
 | 
					#  GeographicLib_LIBRARY_DIRS = /usr/local/lib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					find_library (GeographicLib_LIBRARIES Geographic
 | 
				
			||||||
 | 
					  PATHS "${CMAKE_INSTALL_PREFIX}/../GeographicLib/lib")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (GeographicLib_LIBRARIES)
 | 
				
			||||||
 | 
					  get_filename_component (GeographicLib_LIBRARY_DIRS
 | 
				
			||||||
 | 
					    "${GeographicLib_LIBRARIES}" PATH)
 | 
				
			||||||
 | 
					  get_filename_component (_ROOT_DIR "${GeographicLib_LIBRARY_DIRS}" PATH)
 | 
				
			||||||
 | 
					  set (GeographicLib_INCLUDE_DIRS "${_ROOT_DIR}/include")
 | 
				
			||||||
 | 
					  set (GeographicLib_BINARY_DIRS "${_ROOT_DIR}/bin")
 | 
				
			||||||
 | 
					  if (NOT EXISTS "${GeographicLib_INCLUDE_DIRS}/GeographicLib/Config.h")
 | 
				
			||||||
 | 
					    # On Debian systems the library is in e.g.,
 | 
				
			||||||
 | 
					    #   /usr/lib/x86_64-linux-gnu/libGeographic.so
 | 
				
			||||||
 | 
					    # so try stripping another element off _ROOT_DIR
 | 
				
			||||||
 | 
					    get_filename_component (_ROOT_DIR "${_ROOT_DIR}" PATH)
 | 
				
			||||||
 | 
					    set (GeographicLib_INCLUDE_DIRS "${_ROOT_DIR}/include")
 | 
				
			||||||
 | 
					    set (GeographicLib_BINARY_DIRS "${_ROOT_DIR}/bin")
 | 
				
			||||||
 | 
					    if (NOT EXISTS "${GeographicLib_INCLUDE_DIRS}/GeographicLib/Config.h")
 | 
				
			||||||
 | 
					      unset (GeographicLib_INCLUDE_DIRS)
 | 
				
			||||||
 | 
					      unset (GeographicLib_LIBRARIES)
 | 
				
			||||||
 | 
					      unset (GeographicLib_LIBRARY_DIRS)
 | 
				
			||||||
 | 
					      unset (GeographicLib_BINARY_DIRS)
 | 
				
			||||||
 | 
					    endif ()
 | 
				
			||||||
 | 
					  endif ()
 | 
				
			||||||
 | 
					  unset (_ROOT_DIR)
 | 
				
			||||||
 | 
					endif ()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					include (FindPackageHandleStandardArgs)
 | 
				
			||||||
 | 
					find_package_handle_standard_args (GeographicLib DEFAULT_MSG
 | 
				
			||||||
 | 
					  GeographicLib_LIBRARY_DIRS GeographicLib_LIBRARIES
 | 
				
			||||||
 | 
					  GeographicLib_INCLUDE_DIRS)
 | 
				
			||||||
 | 
					mark_as_advanced (GeographicLib_LIBRARY_DIRS GeographicLib_LIBRARIES
 | 
				
			||||||
 | 
					  GeographicLib_INCLUDE_DIRS)
 | 
				
			||||||
@@ -35,8 +35,8 @@ find_library(GEOSPP_LIBRARIES NAMES geos
 | 
				
			|||||||
if(GEOS_INCLUDE_DIR AND GEOS_LIBRARIES AND NOT TARGET GEOS)
 | 
					if(GEOS_INCLUDE_DIR AND GEOS_LIBRARIES AND NOT TARGET GEOS)
 | 
				
			||||||
  get_filename_component(GEOS_LIBRARY_DIR ${GEOS_LIBRARIES} PATH)
 | 
					  get_filename_component(GEOS_LIBRARY_DIR ${GEOS_LIBRARIES} PATH)
 | 
				
			||||||
  set(GEOS_FOUND TRUE)
 | 
					  set(GEOS_FOUND TRUE)
 | 
				
			||||||
  add_library(GEOS::Geos INTERFACE IMPORTED)
 | 
					  add_library(Geos::Geos INTERFACE IMPORTED)
 | 
				
			||||||
  set_target_properties(GEOS::Geos PROPERTIES
 | 
					  set_target_properties(Geos::Geos PROPERTIES
 | 
				
			||||||
      INTERFACE_INCLUDE_DIRECTORIES "${GEOS_INCLUDE_DIR}"
 | 
					      INTERFACE_INCLUDE_DIRECTORIES "${GEOS_INCLUDE_DIR}"
 | 
				
			||||||
      INTERFACE_LINK_LIBRARIES "${GEOS_LIBRARIES}"
 | 
					      INTERFACE_LINK_LIBRARIES "${GEOS_LIBRARIES}"
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
@@ -45,8 +45,8 @@ endif()
 | 
				
			|||||||
if(GEOSPP_INCLUDE_DIR AND GEOSPP_LIBRARIES AND NOT TARGET GEOSPP)
 | 
					if(GEOSPP_INCLUDE_DIR AND GEOSPP_LIBRARIES AND NOT TARGET GEOSPP)
 | 
				
			||||||
  get_filename_component(GEOSPP_LIBRARY_DIR ${GEOSPP_LIBRARIES} PATH)
 | 
					  get_filename_component(GEOSPP_LIBRARY_DIR ${GEOSPP_LIBRARIES} PATH)
 | 
				
			||||||
  set(GEOSPP_FOUND TRUE)
 | 
					  set(GEOSPP_FOUND TRUE)
 | 
				
			||||||
  add_library(GEOS::GeosPP INTERFACE IMPORTED)
 | 
					  add_library(Geos::GeosPP INTERFACE IMPORTED)
 | 
				
			||||||
  set_target_properties(GEOS::GeosPP PROPERTIES
 | 
					  set_target_properties(Geos::GeosPP PROPERTIES
 | 
				
			||||||
      INTERFACE_INCLUDE_DIRECTORIES "${GEOSPP_INCLUDE_DIR}"
 | 
					      INTERFACE_INCLUDE_DIRECTORIES "${GEOSPP_INCLUDE_DIR}"
 | 
				
			||||||
      INTERFACE_LINK_LIBRARIES "${GEOSPP_LIBRARIES}"
 | 
					      INTERFACE_LINK_LIBRARIES "${GEOSPP_LIBRARIES}"
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
							
								
								
									
										39
									
								
								FindProj.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								FindProj.cmake
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,39 @@
 | 
				
			|||||||
 | 
					set(PROJ_PREFIX "" CACHE PATH "The path to the prefix of an Proj installation")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					find_path(PROJ_INCLUDE_DIR NAMES proj.h proj_api.h
 | 
				
			||||||
 | 
					  PATHS
 | 
				
			||||||
 | 
					  ${PROJ_PREFIX}/include
 | 
				
			||||||
 | 
					  /opt/local/include
 | 
				
			||||||
 | 
					  /usr/include
 | 
				
			||||||
 | 
					  /usr/local/include
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					find_library(PROJ_LIBRARIES NAMES proj
 | 
				
			||||||
 | 
					  PATHS
 | 
				
			||||||
 | 
					  ${PROJ_PREFIX}/lib
 | 
				
			||||||
 | 
					  /opt/local/lib
 | 
				
			||||||
 | 
					  /usr/lib
 | 
				
			||||||
 | 
					  /usr/local/lib
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if(PROJ_INCLUDE_DIR AND PROJ_LIBRARIES AND NOT TARGET PROJ)
 | 
				
			||||||
 | 
					  get_filename_component(PROJ_LIBRARY_DIR ${PROJ_LIBRARIES} PATH)
 | 
				
			||||||
 | 
					  set(PROJ_FOUND TRUE)
 | 
				
			||||||
 | 
					  add_library(Proj::Proj INTERFACE IMPORTED)
 | 
				
			||||||
 | 
					  set_target_properties(Proj::Proj PROPERTIES
 | 
				
			||||||
 | 
					      INTERFACE_INCLUDE_DIRECTORIES "${PROJ_INCLUDE_DIR}"
 | 
				
			||||||
 | 
					      INTERFACE_LINK_LIBRARIES "${PROJ_LIBRARIES}"
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if(PROJ_FOUND)
 | 
				
			||||||
 | 
					  if(NOT PROJ_FIND_QUIETLY)
 | 
				
			||||||
 | 
					    MESSAGE(STATUS "Found Proj: ${PROJ_LIBRARIES}")
 | 
				
			||||||
 | 
					  endif()
 | 
				
			||||||
 | 
					  set(HAVE_PROJ 1)
 | 
				
			||||||
 | 
					elseif(PROJ_FOUND)
 | 
				
			||||||
 | 
					  if(PROJ_FIND_REQUIRED)
 | 
				
			||||||
 | 
					    message(FATAL_ERROR "Could not find Proj")
 | 
				
			||||||
 | 
					  endif()
 | 
				
			||||||
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Reference in New Issue
	
	Block a user