From fd8057eb54fee8aa457cc47abb0004f2b71d1e63 Mon Sep 17 00:00:00 2001
From: Volker Enderlein <volkerenderlein@hotmail.com>
Date: Sun, 10 May 2020 15:24:20 +0200
Subject: [PATCH] Added coin-default.cfg.

---
 coin.cfg.cmake.in  | 24 ++++++++++++++++++++++++
 src/CMakeLists.txt |  8 +++++---
 2 files changed, 29 insertions(+), 3 deletions(-)
 create mode 100644 coin.cfg.cmake.in

diff --git a/coin.cfg.cmake.in b/coin.cfg.cmake.in
new file mode 100644
index 000000000..6f41c61c7
--- /dev/null
+++ b/coin.cfg.cmake.in
@@ -0,0 +1,24 @@
+# prefix is determined in coin-config, making the package "movable"
+# prefix="@prefix@"
+host="@host@"
+exec_prefix="@exec_prefix@"
+version="@COIN_VERSION@"
+cflags="@COIN_EXTRA_CFLAGS@"
+cppflags="@COIN_EXTRA_CPPFLAGS@"
+cxxflags="@COIN_EXTRA_CXXFLAGS@"
+ldflags="@COIN_EXTRA_LDFLAGS@"
+libs="@COIN_EXTRA_LIBS@"
+msvcrt="@COIN_MSVC_LIBC@"
+datadir="@datarootdir@"
+includedir="@includedir@"
+frameworkdir="@frameworkdir@"
+htmldir="@htmldir@"
+compiler="@COIN_COMPILER@"
+objext="@OBJEXT@"
+have_3ds_import=@HAVE_3DS_IMPORT_CAPABILITIES@
+have_vrml97=@HAVE_VRML97@
+have_sound=@HAVE_SOUND@
+have_superglu=@HAVE_SUPERGLU@
+have_threads=@HAVE_THREADS@
+have_threadsafe=@HAVE_THREADSAFE@
+compiler_is_gcc=@ac_compiler_gnu@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4ddc1ecd4..6132335b3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -388,9 +388,11 @@ else()
   set(COIN_CONFIG_PACKAGE_LOCATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}-${PROJECT_VERSION})
   string(TOLOWER ${PROJECT_NAME} COIN_CONFIG_PACKAGE_BASENAME)
   if(UNIX OR MINGW)
-    configure_file(${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.pc.cmake.in ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY)
-    install(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
-    install(FILES ${CMAKE_SOURCE_DIR}/bin/coin-config DESTINATION ${CMAKE_INSTALL_BINDIR})
+    configure_file("${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.pc.cmake.in" "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc" @ONLY)
+    install(FILES "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
+    install(PROGRAMS "${CMAKE_SOURCE_DIR}/bin/coin-config" DESTINATION ${CMAKE_INSTALL_BINDIR})
+    configure_file("${CMAKE_SOURCE_DIR}/coin.cfg.cmake.in" "${CMAKE_BINARY_DIR}/${PROJECT_NAME_LOWER}-default.cfg" @ONLY)
+    install(FILES "${CMAKE_BINARY_DIR}/${PROJECT_NAME_LOWER}-default.cfg" DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/Coin/conf)
   endif()
 endif()
 
-- 
2.26.2

