This CMakeLists.txt: > cmake_minimum_required(VERSION 3.12) > find_package(OpenCASCADE REQUIRED) fails during OpenCASCADE discovery: > $ cmake -DOpenCASCADE_DIR=/usr/local/lib/cmake . > CMake Error at /usr/local/lib/cmake/OpenCASCADEFoundationClassesTargets.cmake:79 (message): > The imported target "TKernel" references the file > > "/usr/local/lib${OCCT_INSTALL_BIN_LETTER}/libTKernel.so.7.6.0" > > but this file does not exist. Possible reasons include: > > * The file was deleted, renamed, or moved to another location. > > * An install or uninstall procedure did not complete successfully. > > * The installation package was faulty and contained > > "/usr/local/lib/cmake/OpenCASCADEFoundationClassesTargets.cmake" > > but not all the files it references. > > Call Stack (most recent call first): > /usr/local/lib/cmake/OpenCASCADEConfig.cmake:101 (include) > CMakeLists.txt:10 (find_package) opencascade-7.6.0_6 cmake-3.23.3 FreeBSD 13.1
Could you please give more details on the failing port? cad/freecad and cad/gmsh also use cmake, and they find OpenCASCADE: I'd like to compare their CMakeLists.txt with yours.
The example above is how they find OpenCASCADE: > cmake_minimum_required(VERSION 3.12) > find_package(OpenCASCADE REQUIRED) The same in the context of the f3d project: https://github.com/f3d-app/f3d/blob/master/CMakeLists.txt#L77
Thanks, I have just located the issue: - OpenCASCADE uses a variable OCCT_INSTALL_BIN_LETTER which can be used to install several versions of its libraries (e.g. under lib64 or libd for debug); - in the various OpenCASCADE*Targets-release.cmake (installed under /usr/local/lib/cmake/), the dollar sign of this variable is escaped! E.g. we have "/usr/local/lib\${OCCT_INSTALL_BIN_LETTER}/libTKernel.so.7.6.0" where it should be "/usr/local/lib${OCCT_INSTALL_BIN_LETTER}/libTKernel.so.7.6.0" Note: in our case OCCT_INSTALL_BIN_LETTER is empty. I shall try to fix it ASAP.
A fix has just been committed, please let me know if this is OK for your ports.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=31735a5b1aae9a7967e8cc5f12ffab7779acc53c commit 31735a5b1aae9a7967e8cc5f12ffab7779acc53c Author: Thierry Thomas <thierry@FreeBSD.org> AuthorDate: 2022-09-10 11:05:31 +0000 Commit: Thierry Thomas <thierry@FreeBSD.org> CommitDate: 2022-09-10 11:12:13 +0000 cad/opencascade: fix cmake files A cmake macro, which should have configured $OCCT_INSTALL_BIN_LETTER was not applied correctly. Thus some cmake files where badly configured, and some consumers could not use them. PR: 266280 Reported by: yuri MFH: 2022Q3 cad/opencascade/Makefile | 8 +++++++- .../files/patch-adm_cmake_occt__macros.cmake | 17 ++++++++++++++++- .../files/patch-src_Standard_Standard__CString.cxx | 4 ++-- 3 files changed, 25 insertions(+), 4 deletions(-)
A commit in branch 2022Q3 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=3f4f4b240990348b8b261be32e797811f5ee09b4 commit 3f4f4b240990348b8b261be32e797811f5ee09b4 Author: Thierry Thomas <thierry@FreeBSD.org> AuthorDate: 2022-09-10 11:05:31 +0000 Commit: Thierry Thomas <thierry@FreeBSD.org> CommitDate: 2022-09-17 12:38:38 +0000 cad/opencascade: fix cmake files A cmake macro, which should have configured $OCCT_INSTALL_BIN_LETTER was not applied correctly. Thus some cmake files where badly configured, and some consumers could not use them. PR: 266280 Reported by: yuri MFH: 2022Q3 (cherry picked from commit 31735a5b1aae9a7967e8cc5f12ffab7779acc53c) cad/opencascade/Makefile | 8 +++++++- .../files/patch-adm_cmake_occt__macros.cmake | 17 ++++++++++++++++- .../files/patch-src_Standard_Standard__CString.cxx | 4 ++-- 3 files changed, 25 insertions(+), 4 deletions(-)
(In reply to Thierry Thomas from comment #4) Thanks Thierry, My port graphics/f3d now builds fine with OpenCascade. Yuri
(In reply to Yuri Victorovich from comment #7) You’re welcome!