File 0001-Use-a-Find-module-to-find-older-Coin-versions.patch of Package SoQt
From e0cf6fc5aec294367d3d0fead95ab84bcc488d9b Mon Sep 17 00:00:00 2001
From: Christophe Giboudeaux <christophe@krop.fr>
Date: Mon, 13 May 2019 12:05:49 +0200
Subject: [PATCH] Use a Find module to find older Coin versions.
We want to use a SoQt snapshot to replace the Qt4 dependency but keep the current stable Coin version.
As the current Coin version doesn't provide a CMake config file, we'll use a FindCoin.cmake module.
---
CMakeLists.txt | 4 ++-
FindCoin.cmake | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 91 insertions(+), 1 deletion(-)
create mode 100644 FindCoin.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a01e59..7960b72 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.0)
+set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR})
+
set(gui qt)
set(Gui Qt)
set(GUI QT)
@@ -94,7 +96,7 @@ cmake_dependent_option(SO${GUI}_BUILD_MAC_FRAMEWORK "Build framework instead of
find_package(OpenGL REQUIRED)
# Coin is typically installed as Inventor.framework on APPLE
-find_package(Coin NAMES Inventor Coin REQUIRED)
+find_package(Coin MODULE REQUIRED)
if(SO${GUI}_USE_QT5)
find_package(Qt5 COMPONENTS Core Gui OpenGL Widgets QUIET)
diff --git a/FindCoin.cmake b/FindCoin.cmake
new file mode 100644
index 0000000..3c6762a
--- /dev/null
+++ b/FindCoin.cmake
@@ -0,0 +1,88 @@
+#.rst:
+# FindCoin
+# ---------
+#
+# Try to find the Coin library.
+# This module is temporary and only meant to find older Coin versions when using
+# GIT snapshots for SoQt.
+#
+# This will define the following variables:
+#
+# ``Coin_FOUND``
+# Coin was found.
+#
+# ``Coin_VERSION``
+# The version of Coin.
+#
+# ``Coin_INCLUDE_DIRS``
+# This should be passed to target_include_directories() if
+# the target is not used for linking.
+#
+# ``Coin_LIBRARIES``
+# The Coin library.
+# This can be passed to target_link_libraries() instead of
+# the ``Coin::Coin`` target
+#
+# If ``Coin_FOUND`` is TRUE, the following imported target
+# will be available:
+#
+# ``Coin::Coin``
+# The Coin library
+#
+#=============================================================================
+# Copyright 2019 Christophe Giboudeaux <christophe@krop.fr>
+#
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#=============================================================================
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_Coin Coin)
+
+find_path(Coin_INCLUDE_DIRS
+ NAMES Inventor/So.h
+ HINTS ${PC_Coin_INCLUDEDIR}
+)
+
+find_library(Coin_LIBRARIES
+ NAMES Coin
+ HINTS ${PC_Coin_LIBDIR}
+)
+
+set(Coin_VERSION "${PC_Coin_VERSION}")
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(Coin
+ FOUND_VAR Coin_FOUND
+ REQUIRED_VARS Coin_LIBRARIES Coin_INCLUDE_DIRS
+ VERSION_VAR Coin_VERSION
+)
+if(Coin_FOUND AND NOT TARGET Coin::Coin)
+ add_library(Coin::Coin UNKNOWN IMPORTED)
+ set_target_properties(Coin::Coin PROPERTIES
+ IMPORTED_LOCATION "${Coin_LIBRARIES}"
+ INTERFACE_INCLUDE_DIRECTORIES "${Coin_INCLUDE_DIRS}")
+endif()
+
+mark_as_advanced(Coin_LIBRARIES Coin_INCLUDE_DIRS Coin_VERSION)
--
2.21.0