From 3d2f3615857b6365810fb375cf19cf96f5dd9813 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Thu, 18 Sep 2025 18:18:22 +0500 Subject: [PATCH] cmake - fix error with occt package (1857d0624) --- cmake/CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index e9ef5d9ed3..6b1a33eb16 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -484,7 +484,11 @@ if(BUILD_IFCGEOM) # and also has an odd directory structure (install/lib/oce-0.18/*.cmake). find_package(OpenCASCADE CONFIG REQUIRED) set(OCC_INCLUDE_DIR ${OpenCASCADE_INCLUDE_DIR}) - set(OCC_LIBRARY_DIR ${OpenCASCADE_LIBRARY_DIR}) + # Do not use OpenCASCADE_LIBRARY_DIR for OCC_LIBRARY_DIR - check target property explicitly. + # On Windows there is a case with OpenCASCADE_LIBRARY_DIR points to `lib` folder, + # while TKernel is actually in `libi`. + get_target_property(TKERNEL_LIB_PATH TKernel LOCATION) + get_filename_component(OCC_LIBRARY_DIR "${TKERNEL_LIB_PATH}" DIRECTORY) set(OCC_VERSION_STRING ${OpenCASCADE_VERSION}) message( STATUS @@ -525,7 +529,10 @@ if(BUILD_IFCGEOM) if(libTKernel) message(STATUS "Required Open Cascade Library files found") else() - message(FATAL_ERROR "Unable to find Open Cascade library files, aborting") + message( + FATAL_ERROR + "Unable to find Open Cascade library files in OCC_LIBRARY_DIR ('${OCC_LIBRARY_DIR}'), aborting" + ) endif() # Use the found libTKernel as a template for all other OCC libraries