Skip to content

Commit 67a2905

Browse files
committed
CMake: Remove GeoGraphicLib Targets
1 parent 7ec8876 commit 67a2905

File tree

3 files changed

+82
-19
lines changed

3 files changed

+82
-19
lines changed

Diff for: src/AnalyzeView/CMakeLists.txt

+26-11
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,18 @@ if(TARGET ulog_cpp::ulog_cpp)
9494
target_link_libraries(QGC PRIVATE ulog_cpp::ulog_cpp)
9595
endif()
9696

97+
#===========================================================================#
98+
99+
set(EXPAT_EXTRA_OPTIONS)
100+
if(WIN32)
101+
list(APPEND EXPAT_EXTRA_OPTIONS "EXPAT_MSVC_STATIC_CRT ON")
102+
endif()
103+
97104
CPMAddPackage(
98105
NAME EXPAT
99-
VERSION 2.6.4
106+
VERSION 2.7.0
100107
GITHUB_REPOSITORY libexpat/libexpat
101-
GIT_TAG "R_2_6_4"
108+
GIT_TAG "R_2_7_0"
102109
SOURCE_SUBDIR expat
103110
OPTIONS
104111
"EXPAT_BUILD_DOCS OFF"
@@ -109,23 +116,28 @@ CPMAddPackage(
109116
"EXPAT_BUILD_TOOLS OFF"
110117
"EXPAT_ENABLE_INSTALL OFF"
111118
"EXPAT_SHARED_LIBS OFF"
119+
"${EXPAT_EXTRA_OPTIONS}"
112120
)
113121

114122
set(_EXIV2_ENABLE_XMP OFF)
115123
if(EXPAT_ADDED)
116-
find_package(expat CONFIG QUIET)
117-
if(NOT TARGET expat::expat)
118-
find_package(EXPAT MODULE)
119-
if(EXPAT_FOUND)
120-
if(NOT TARGET expat::expat)
121-
add_library(expat::expat INTERFACE IMPORTED)
122-
target_link_libraries(expat::expat INTERFACE EXPAT::EXPAT)
123-
endif()
124-
set(_EXIV2_ENABLE_XMP ON)
124+
set(EXPAT_USE_STATIC_LIBS ON)
125+
find_package(EXPAT MODULE)
126+
if(NOT TARGET EXPAT::EXPAT)
127+
find_package(expat CONFIG)
128+
if(TARGET expat::expat)
129+
add_library(EXPAT::EXPAT INTERFACE IMPORTED)
130+
target_link_libraries(EXPAT::EXPAT INTERFACE expat::expat)
125131
endif()
126132
endif()
133+
134+
if(TARGET EXPAT::EXPAT)
135+
set(_EXIV2_ENABLE_XMP ON)
136+
endif()
127137
endif()
128138

139+
#===========================================================================#
140+
129141
CPMAddPackage(
130142
NAME exiv2
131143
VERSION 0.28.5
@@ -154,6 +166,9 @@ CPMAddPackage(
154166
)
155167

156168
if(TARGET Exiv2::exiv2lib)
169+
if(_EXIV2_ENABLE_XMP AND TARGET exiv2-xmp)
170+
target_link_libraries(exiv2-xmp PRIVATE EXPAT::EXPAT)
171+
endif()
157172
target_link_libraries(QGC PRIVATE Exiv2::exiv2lib)
158173
target_include_directories(QGC PRIVATE ${CMAKE_BINARY_DIR})
159174
endif()

Diff for: src/Utilities/Geo/CMakeLists.txt

+1-8
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,6 @@ if(LINUX AND EXISTS "/usr/share/cmake/geographiclib")
2121
endif()
2222

2323
include(CPM)
24-
# CPMAddPackage(
25-
# NAME geographiclib
26-
# VERSION 2.5
27-
# URL https://sourceforge.net/projects/geographiclib/files/distrib-C%2B%2B/GeographicLib-2.5.tar.gz/download
28-
# DOWNLOAD_ONLY
29-
# SOURCE_SUBDIR src
30-
# )
31-
3224
CPMAddPackage(
3325
NAME geographiclib
3426
VERSION 2.5
@@ -50,6 +42,7 @@ CPMAddPackage(
5042
"PKGDIR OFF"
5143
"DOCDIR OFF"
5244
"EXAMPLEDIR OFF"
45+
PATCH_COMMAND "git apply ${CMAKE_CURRENT_SOURCE_DIR}/geographiclib.patch"
5346
)
5447

5548
if(TARGET GeographicLib::GeographicLib)

Diff for: src/Utilities/Geo/geographiclib.patch

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index 40d0b206..738d6c83 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -452,32 +452,32 @@ if (WIN32)
6+
endif ()
7+
8+
# The list of tools (to be installed into, e.g., /usr/local/bin)
9+
-set (TOOLS CartConvert ConicProj GeodesicProj GeoConvert GeodSolve
10+
- GeoidEval Gravity IntersectTool MagneticField Planimeter RhumbSolve
11+
- TransverseMercatorProj)
12+
+# set (TOOLS CartConvert ConicProj GeodesicProj GeoConvert GeodSolve
13+
+# GeoidEval Gravity IntersectTool MagneticField Planimeter RhumbSolve
14+
+# TransverseMercatorProj)
15+
# The list of scripts (to be installed into, e.g., /usr/local/sbin)
16+
-set (SCRIPTS geographiclib-get-geoids geographiclib-get-gravity
17+
- geographiclib-get-magnetic)
18+
+# set (SCRIPTS geographiclib-get-geoids geographiclib-get-gravity
19+
+# geographiclib-get-magnetic)
20+
21+
set_property (GLOBAL PROPERTY USE_FOLDERS ON)
22+
23+
# The list of subdirectories to process
24+
add_subdirectory (src)
25+
add_subdirectory (include/GeographicLib)
26+
-add_subdirectory (tools)
27+
-add_subdirectory (man)
28+
-add_subdirectory (doc)
29+
-if (EXAMPLEDIR)
30+
- set (CALLED_FROM_TOPLEVEL ON)
31+
- add_subdirectory (examples) # This just installs the examples
32+
-endif ()
33+
+# add_subdirectory (tools)
34+
+# add_subdirectory (man)
35+
+# add_subdirectory (doc)
36+
+# if (EXAMPLEDIR)
37+
+# set (CALLED_FROM_TOPLEVEL ON)
38+
+# add_subdirectory (examples) # This just installs the examples
39+
+# endif ()
40+
add_subdirectory (cmake)
41+
-enable_testing ()
42+
-add_subdirectory (tests)
43+
-add_subdirectory (experimental)
44+
-if (NOT RELEASE)
45+
- add_subdirectory (develop)
46+
-endif ()
47+
+# enable_testing ()
48+
+# add_subdirectory (tests)
49+
+# add_subdirectory (experimental)
50+
+# if (NOT RELEASE)
51+
+# add_subdirectory (develop)
52+
+# endif ()
53+
54+
# make exampleprograms does a fresh cmake configuration and so uses
55+
# find_package to find the just-built version of GeographicLib (via the

0 commit comments

Comments
 (0)