From cefaa5bddedcb90a06d6ef8f0837a11619e5d87e Mon Sep 17 00:00:00 2001
From: Bernd Waibel <waebbl-gentoo@posteo.net>
Date: Tue, 9 Feb 2021 20:58:43 +0100
Subject: [PATCH] fix issue with cmake path variables

Thanks to Fabio Rossi for reporting the issue.
Upstream bug: https://tracker.dev.opencascade.org/view.php?id=32035

Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net>
---
 adm/templates/OpenCASCADEConfig.cmake.in | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/adm/templates/OpenCASCADEConfig.cmake.in b/adm/templates/OpenCASCADEConfig.cmake.in
index 4937103b..db99a8d1 100644
--- a/adm/templates/OpenCASCADEConfig.cmake.in
+++ b/adm/templates/OpenCASCADEConfig.cmake.in
@@ -16,19 +16,7 @@ set (OpenCASCADE_MINOR_VERSION       "@OCC_VERSION_MINOR@")
 set (OpenCASCADE_MAINTENANCE_VERSION "@OCC_VERSION_MAINTENANCE@")
 set (OpenCASCADE_DEVELOPMENT_VERSION "@OCC_VERSION_DEVELOPMENT@")
 
-# Compute the installation prefix from this OpenCASCADEConfig.cmake file 
-# location, by going up one level + one level if "cmake" + one level if "lib".
-# This is made to support different locations of CMake files:
-# - in UNIX style: $INSTALL_DIR/lib/cmake/opencascade-<version>
-# - in Windows style: $INSTALL_DIR/cmake
-get_filename_component (OpenCASCADE_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
-get_filename_component (OpenCASCADE_INSTALL_PREFIX "${OpenCASCADE_INSTALL_PREFIX}" PATH)
-if (OpenCASCADE_INSTALL_PREFIX MATCHES "/cmake$")
-  get_filename_component (OpenCASCADE_INSTALL_PREFIX "${OpenCASCADE_INSTALL_PREFIX}" PATH)
-endif()
-if (OpenCASCADE_INSTALL_PREFIX MATCHES "/lib$")
-  get_filename_component (OpenCASCADE_INSTALL_PREFIX "${OpenCASCADE_INSTALL_PREFIX}" PATH)
-endif()
+set (OpenCASCADE_INSTALL_PREFIX "$ENV{CASROOT}")
 
 # Set OpenCASCADE paths to headers, binaries, libraries, resources, tests, samples, data
 set (OpenCASCADE_BINARY_DIR   "${OpenCASCADE_INSTALL_PREFIX}/@INSTALL_DIR_BIN@")
-- 
2.30.0

