$NetBSD: patch-CMakeLists.txt,v 1.10 2019/06/03 15:20:59 bouyer Exp $

--- CMakeLists.txt.orig	2019-03-23 02:25:59.000000000 +0100
+++ CMakeLists.txt	2019-06-03 15:10:23.518458870 +0200
@@ -157,7 +157,19 @@
 # Based on code from nohal
 IF (NOT WIN32)
   # default
-  SET (ARCH "i386")
+  IF (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
+    IF (CMAKE_SIZEOF_VOID_P MATCHES "8")
+      SET (ARCH "aarch64")
+    ELSE (CMAKE_SIZEOF_VOID_P MATCHES "8")
+      SET (ARCH "armhf")
+    ENDIF (CMAKE_SIZEOF_VOID_P MATCHES "8")
+  ELSE (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
+    IF (CMAKE_SIZEOF_VOID_P MATCHES "8")
+      SET (ARCH "x86_64")
+    ELSE (CMAKE_SIZEOF_VOID_P MATCHES "8")
+      SET (ARCH "i386")
+    ENDIF (CMAKE_SIZEOF_VOID_P MATCHES "8")
+  ENDIF (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
   SET (LIB_INSTALL_DIR "lib")
   IF (EXISTS /etc/debian_version)
     SET (PACKAGE_FORMAT "DEB")
@@ -191,7 +203,6 @@
     ELSE (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
       IF (CMAKE_SIZEOF_VOID_P MATCHES "8")
         SET (ARCH "x86_64")
-        SET (LIB_INSTALL_DIR "lib64")
       ELSE (CMAKE_SIZEOF_VOID_P MATCHES "8")
         SET (ARCH "i386")
         SET (LIB_INSTALL_DIR "lib")
@@ -413,6 +424,7 @@
   SET(wxWidgets_USE_LIBS net xml html adv aui core base webview)
 ENDIF()
 
+
 OPTION (USE_GL "Enable OpenGL support" ON)
 
 # Prefer libGL.so to libOpenGL.so, see CMP0072
@@ -1033,7 +1045,6 @@
 
 
 IF(NOT WIN32 AND NOT APPLE AND NOT QT_ANDROID)
-  OPTION(OCPN_FORCE_GTK3 "Force the build to use GTK3" OFF)
 
 
   IF(NOT OCPN_FORCE_GTK3)
@@ -1053,14 +1064,14 @@
     set(wxWidgets_CONFIG_OPTIONS ${wxWidgets_CONFIG_OPTIONS} --toolkit=gtk3)
     MESSAGE(STATUS "Building against GTK3...")
   ENDIF(GTK2_FOUND)
-  FIND_PACKAGE(wxWidgets)
+  FIND_PACKAGE(wxWidgets COMPONENTS ${wxWidgets_USE_LIBS})
   if (wxWidgets_FOUND)
     message(STATUS "Found wxWidgets webview add-on")
     add_definitions(-DOCPN_USE_WEBVIEW)
   else ()
     list(REMOVE_ITEM wxWidgets_USE_LIBS webview)
     message(STATUS "Could not find wxWidgets webview add-on")
-    FIND_PACKAGE(wxWidgets REQUIRED)
+    FIND_PACKAGE(wxWidgets REQUIRED ${wxWidgets_USE_LIBS})
   endif ()
   MESSAGE (STATUS "Found wxWidgets..." )
   MESSAGE (STATUS " wxWidgets Include: ${wxWidgets_INCLUDE_DIRS}")
@@ -2336,6 +2347,7 @@
 #   So, add them manually.  These declarations may be redundant in some architectures, but do no harm.
 IF(CMAKE_SYSTEM_NAME MATCHES ".*Linux")
   TARGET_LINK_LIBRARIES( ${PACKAGE_NAME} dl )
+  SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--export-dynamic")
 ENDIF(CMAKE_SYSTEM_NAME MATCHES ".*Linux")
 
 
