1 diff --git a/CMakeLists.txt b/CMakeLists.txt
2 index 345df69b..cb891034 100644
5 @@ -196,6 +196,11 @@ else ()
9 +set (INSTALL_TOOL_DIR "tools/geographiclib")
10 +file (RELATIVE_PATH PROJECT_LIB_DIR
11 + "${CMAKE_INSTALL_PREFIX}/${INSTALL_TOOL_DIR}"
12 + "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
15 # Set the run time path for shared libraries for non-Windows machines.
16 # (1) include link path for external packages (not needed with
17 @@ -207,7 +212,7 @@ if (NOT MSVC)
18 # (2) include installed path for GeographicLib.
20 # Use relative path so that package is relocatable
21 - set (CMAKE_INSTALL_RPATH "\$ORIGIN/../lib${LIB_SUFFIX}")
22 + set (CMAKE_INSTALL_RPATH "\$ORIGIN/${PROJECT_LIB_DIR}")
24 # cmake 2.8.12 introduced a way to make the package relocatable.
25 # See also INSTALL_RPATH property on the tools.
26 @@ -434,12 +439,12 @@ endif ()
27 # documentation files into the source tree. Skip Apple here because
28 # man/makeusage.sh uses "head --lines -4" to drop the last 4 lines of a
29 # file and there's no simple equivalent for MacOSX
30 -if (NOT WIN32 AND NOT APPLE)
31 +if (NOT WIN32 AND NOT APPLE AND FALSE)
32 find_program (HAVE_POD2MAN pod2man)
33 find_program (HAVE_POD2HTML pod2html)
34 find_program (HAVE_COL col)
36 -if (HAVE_POD2MAN AND HAVE_POD2HTML AND HAVE_COL)
37 +if (HAVE_POD2MAN AND HAVE_POD2HTML AND HAVE_COL AND FALSE)
41 @@ -466,25 +471,34 @@ if (WIN32)
42 set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
49 # The list of tools (to be installed into, e.g., /usr/local/bin)
50 set (TOOLS CartConvert ConicProj GeodesicProj GeoConvert GeodSolve
51 GeoidEval Gravity MagneticField Planimeter RhumbSolve TransverseMercatorProj)
52 # The list of scripts (to be installed into, e.g., /usr/local/sbin)
53 set (SCRIPTS geographiclib-get-geoids geographiclib-get-gravity
54 geographiclib-get-magnetic)
57 set_property (GLOBAL PROPERTY USE_FOLDERS ON)
59 # The list of subdirectories to process
60 add_subdirectory (src)
61 add_subdirectory (include/GeographicLib)
63 add_subdirectory (tools)
66 add_subdirectory (man)
67 add_subdirectory (doc)
69 add_subdirectory (matlab)
70 add_subdirectory (python/geographiclib)
71 add_subdirectory (examples)
73 if (MSVC AND BUILD_NETGEOGRAPHICLIB)
74 if (GEOGRAPHICLIB_PRECISION EQUAL 2)
75 set (NETGEOGRAPHICLIB_LIBRARIES NETGeographicLib)
76 diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
77 index cbc21961..69c923bc 100644
78 --- a/cmake/CMakeLists.txt
79 +++ b/cmake/CMakeLists.txt
80 @@ -33,10 +33,10 @@ configure_file (project-config.cmake.in
81 configure_file (project-config-version.cmake.in
82 "${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake" @ONLY)
84 - ${PROJECT_ALL_LIBRARIES} ${TOOLS}
85 + ${PROJECT_ALL_LIBRARIES}
86 FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-targets.cmake")
88 - ${PROJECT_ALL_LIBRARIES} ${TOOLS}
89 + ${PROJECT_ALL_LIBRARIES}
90 NAMESPACE ${PROJECT_NAME}::
91 FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-namespace-targets.cmake")
93 @@ -44,13 +44,7 @@ export (TARGETS
94 # ${INSTALL_CMAKE_DIR} and @PROJECT_ROOT_DIR@ is the relative
95 # path to the root from there. (Note that the whole install tree can
97 -if (COMMON_INSTALL_PATH)
98 - # Install under lib${LIB_SUFFIX} so that 32-bit and 64-bit packages
99 - # can be installed on a single machine.
100 - set (INSTALL_CMAKE_DIR "lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}")
102 - set (INSTALL_CMAKE_DIR "cmake")
104 +set (INSTALL_CMAKE_DIR "share/${PROJECT_NAME_LOWER}")
105 # Find root of install tree relative to INSTALL_CMAKE_DIR
106 file (RELATIVE_PATH PROJECT_ROOT_DIR
107 "${CMAKE_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR}" "${CMAKE_INSTALL_PREFIX}")
108 diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
109 index 3fa8ec6a..92c73946 100644
110 --- a/tools/CMakeLists.txt
111 +++ b/tools/CMakeLists.txt
115 # Where to find the *.usage files for the --help option.
116 -include_directories (${PROJECT_BINARY_DIR}/man)
117 +include_directories (${PROJECT_SOURCE_DIR}/man)
118 # Only needed if target_compile_definitions is not supported
119 add_definitions (${PROJECT_DEFINITIONS})
121 @@ -16,7 +16,7 @@ foreach (TOOL ${TOOLS})
122 add_dependencies (tools ${TOOL})
124 set_source_files_properties (${TOOL}.cpp PROPERTIES
125 - OBJECT_DEPENDS ${PROJECT_BINARY_DIR}/man/${TOOL}.usage)
126 + OBJECT_DEPENDS ${PROJECT_SOURCE_DIR}/man/${TOOL}.usage)
128 target_link_libraries (${TOOL} ${PROJECT_LIBRARIES} ${HIGHPREC_LIBRARIES})
130 @@ -31,11 +31,11 @@ endif ()
132 # Ensure that the package is relocatable
133 set_target_properties (${TOOLS} PROPERTIES
134 - INSTALL_RPATH "@loader_path/../lib${LIB_SUFFIX}")
135 + INSTALL_RPATH "@loader_path/${PROJECT_LIB_DIR}")
138 # Specify where the tools are installed, adding them to the export targets
139 -install (TARGETS ${TOOLS} EXPORT targets DESTINATION bin)
140 +install (TARGETS ${TOOLS} DESTINATION "${INSTALL_TOOL_DIR}")
142 if (MSVC AND PACKAGE_DEBUG_LIBS)
143 # Possibly don't EXPORT the debug versions of the tools and then this
144 @@ -55,7 +55,7 @@ set_property (TARGET tools ${TOOLS} PROPERTY FOLDER tools)
145 # systems. This needs to substitute ${GEOGRAPHICLIB_DATA} as the
146 # default data directory. These are installed under sbin, because it is
147 # expected to be run with write access to /usr/local.
149 +if (NOT WIN32 AND FALSE)
150 foreach (SCRIPT ${SCRIPTS})
151 configure_file (${SCRIPT}.sh scripts/${SCRIPT} @ONLY)
152 add_custom_command (OUTPUT ${SCRIPT}