vcpkg/ports/geographiclib/cxx-library-only.patch
Charles Karney e7343e50b1
[geographiclib] Update to version 1.51 (#14711)
* [geographiclib] Update to version 1.51

This is just a routine upgrade.

* Use git diff to create patch file

* Preserve execute permissions on tools

* Handle installation of tools so that shared libs are found.

Co-authored-by: Charles Karney <charles.karney@sri.com>
2020-11-30 10:15:15 -08:00

153 lines
5.6 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 345df69b..cb891034 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -196,6 +196,11 @@ else ()
set (DEVELOPER OFF)
endif ()
+set (INSTALL_TOOL_DIR "tools/geographiclib")
+file (RELATIVE_PATH PROJECT_LIB_DIR
+ "${CMAKE_INSTALL_PREFIX}/${INSTALL_TOOL_DIR}"
+ "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
+
if (NOT MSVC)
# Set the run time path for shared libraries for non-Windows machines.
# (1) include link path for external packages (not needed with
@@ -207,7 +212,7 @@ if (NOT MSVC)
# (2) include installed path for GeographicLib.
if (NOT APPLE)
# Use relative path so that package is relocatable
- set (CMAKE_INSTALL_RPATH "\$ORIGIN/../lib${LIB_SUFFIX}")
+ set (CMAKE_INSTALL_RPATH "\$ORIGIN/${PROJECT_LIB_DIR}")
else ()
# cmake 2.8.12 introduced a way to make the package relocatable.
# See also INSTALL_RPATH property on the tools.
@@ -434,12 +439,12 @@ endif ()
# documentation files into the source tree. Skip Apple here because
# man/makeusage.sh uses "head --lines -4" to drop the last 4 lines of a
# file and there's no simple equivalent for MacOSX
-if (NOT WIN32 AND NOT APPLE)
+if (NOT WIN32 AND NOT APPLE AND FALSE)
find_program (HAVE_POD2MAN pod2man)
find_program (HAVE_POD2HTML pod2html)
find_program (HAVE_COL col)
endif ()
-if (HAVE_POD2MAN AND HAVE_POD2HTML AND HAVE_COL)
+if (HAVE_POD2MAN AND HAVE_POD2HTML AND HAVE_COL AND FALSE)
set (MAINTAINER ON)
else ()
set (MAINTAINER OFF)
@@ -466,25 +471,34 @@ if (WIN32)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
endif ()
+if (SKIP_TOOLS)
+ set (TOOLS)
+ set (SCRIPTS)
+else ()
# The list of tools (to be installed into, e.g., /usr/local/bin)
set (TOOLS CartConvert ConicProj GeodesicProj GeoConvert GeodSolve
GeoidEval Gravity MagneticField Planimeter RhumbSolve TransverseMercatorProj)
# The list of scripts (to be installed into, e.g., /usr/local/sbin)
set (SCRIPTS geographiclib-get-geoids geographiclib-get-gravity
geographiclib-get-magnetic)
+endif ()
set_property (GLOBAL PROPERTY USE_FOLDERS ON)
# The list of subdirectories to process
add_subdirectory (src)
add_subdirectory (include/GeographicLib)
+if (NOT SKIP_TOOLS)
add_subdirectory (tools)
+endif ()
+if (FALSE)
add_subdirectory (man)
add_subdirectory (doc)
add_subdirectory (js)
add_subdirectory (matlab)
add_subdirectory (python/geographiclib)
add_subdirectory (examples)
+endif ()
if (MSVC AND BUILD_NETGEOGRAPHICLIB)
if (GEOGRAPHICLIB_PRECISION EQUAL 2)
set (NETGEOGRAPHICLIB_LIBRARIES NETGeographicLib)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index cbc21961..69c923bc 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -33,10 +33,10 @@ configure_file (project-config.cmake.in
configure_file (project-config-version.cmake.in
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake" @ONLY)
export (TARGETS
- ${PROJECT_ALL_LIBRARIES} ${TOOLS}
+ ${PROJECT_ALL_LIBRARIES}
FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-targets.cmake")
export (TARGETS
- ${PROJECT_ALL_LIBRARIES} ${TOOLS}
+ ${PROJECT_ALL_LIBRARIES}
NAMESPACE ${PROJECT_NAME}::
FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-namespace-targets.cmake")
@@ -44,13 +44,7 @@ export (TARGETS
# ${INSTALL_CMAKE_DIR} and @PROJECT_ROOT_DIR@ is the relative
# path to the root from there. (Note that the whole install tree can
# be relocated.)
-if (COMMON_INSTALL_PATH)
- # Install under lib${LIB_SUFFIX} so that 32-bit and 64-bit packages
- # can be installed on a single machine.
- set (INSTALL_CMAKE_DIR "lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}")
-else ()
- set (INSTALL_CMAKE_DIR "cmake")
-endif ()
+set (INSTALL_CMAKE_DIR "share/${PROJECT_NAME_LOWER}")
# Find root of install tree relative to INSTALL_CMAKE_DIR
file (RELATIVE_PATH PROJECT_ROOT_DIR
"${CMAKE_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR}" "${CMAKE_INSTALL_PREFIX}")
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 3fa8ec6a..92c73946 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -1,7 +1,7 @@
# Build the tools...
# Where to find the *.usage files for the --help option.
-include_directories (${PROJECT_BINARY_DIR}/man)
+include_directories (${PROJECT_SOURCE_DIR}/man)
# Only needed if target_compile_definitions is not supported
add_definitions (${PROJECT_DEFINITIONS})
@@ -16,7 +16,7 @@ foreach (TOOL ${TOOLS})
add_dependencies (tools ${TOOL})
set_source_files_properties (${TOOL}.cpp PROPERTIES
- OBJECT_DEPENDS ${PROJECT_BINARY_DIR}/man/${TOOL}.usage)
+ OBJECT_DEPENDS ${PROJECT_SOURCE_DIR}/man/${TOOL}.usage)
target_link_libraries (${TOOL} ${PROJECT_LIBRARIES} ${HIGHPREC_LIBRARIES})
@@ -31,11 +31,11 @@ endif ()
if (APPLE)
# Ensure that the package is relocatable
set_target_properties (${TOOLS} PROPERTIES
- INSTALL_RPATH "@loader_path/../lib${LIB_SUFFIX}")
+ INSTALL_RPATH "@loader_path/${PROJECT_LIB_DIR}")
endif ()
# Specify where the tools are installed, adding them to the export targets
-install (TARGETS ${TOOLS} EXPORT targets DESTINATION bin)
+install (TARGETS ${TOOLS} DESTINATION "${INSTALL_TOOL_DIR}")
if (MSVC AND PACKAGE_DEBUG_LIBS)
# Possibly don't EXPORT the debug versions of the tools and then this
@@ -55,7 +55,7 @@ set_property (TARGET tools ${TOOLS} PROPERTY FOLDER tools)
# systems. This needs to substitute ${GEOGRAPHICLIB_DATA} as the
# default data directory. These are installed under sbin, because it is
# expected to be run with write access to /usr/local.
-if (NOT WIN32)
+if (NOT WIN32 AND FALSE)
foreach (SCRIPT ${SCRIPTS})
configure_file (${SCRIPT}.sh scripts/${SCRIPT} @ONLY)
add_custom_command (OUTPUT ${SCRIPT}