Bug 274834 - cad/opencascade: Installs cmake files into wrong location (was: devel/cmake-core: cmake fails to find cmake config files in /usr/local/lib/cmake)
Summary: cad/opencascade: Installs cmake files into wrong location (was: devel/cmake-c...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Thierry Thomas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-31 17:27 UTC by Yuri Victorovich
Modified: 2023-11-05 13:11 UTC (History)
4 users (show)

See Also:
thierry: maintainer-feedback+


Attachments
Fix cmake files (3.13 KB, patch)
2023-11-04 19:36 UTC, Thierry Thomas
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer freebsd_triage 2023-10-31 17:27:22 UTC
This script fails to find OpenCASCADE (cad/opencascade):

> cmake_minimum_required(VERSION 3.26)
> #set(CMAKE_PREFIX_PATH "/usr/local/lib")
> find_package(OpenCASCADE CONFIG REQUIRED)

The second line needs to be un-commented as a workaround, which shouldn't be the case.

cmake obviously doesn't look for config files in /usr/local/lib/cmake.

I am not sure what is the correct search path in general, but it should either include /usr/local/lib/cmake by default, or all packages that install config files into /usr/local/lib/cmake should be changed to move them into the searched location.

Otherwise this would cause problems for many ports.

cmake-core-3.26.1_3
Comment 1 Daniel Engberg freebsd_committer freebsd_triage 2023-11-01 20:00:45 UTC
From what I can tell by the documentation this seems to be misused by upstream?
https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html

Related:
https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure
Comment 2 Jason E. Hale freebsd_committer freebsd_triage 2023-11-02 18:22:44 UTC
It looks like cad/opencascade is installing its CMake files into the wrong location. ${PREFIX}/lib/cmake/${PROJECT_NAME} is typical, but opencascade is dumping its files directly into ${PREFIX}/lib/cmake for some reason.

This isn't a CMake problem. Ports that install files outside of the expected search paths should be fixed.
Comment 3 Thierry Thomas freebsd_committer freebsd_triage 2023-11-04 19:36:41 UTC
Created attachment 246127 [details]
Fix cmake files

In this case pathfix does nothing, but the attached patch should do the trick.
Comment 4 Thierry Thomas freebsd_committer freebsd_triage 2023-11-04 19:37:39 UTC
Before committing my patch, I have to check that is does not break the consumers of OpenCASCADE.
Comment 5 Thierry Thomas freebsd_committer freebsd_triage 2023-11-05 08:43:54 UTC
(In reply to Thierry Thomas from comment #4)

Not good, it breaks cad/PrusaSlicer. Let’s try another one.
Comment 6 Thierry Thomas freebsd_committer freebsd_triage 2023-11-05 13:10:19 UTC
Committed, the second try was OK. Thanks for the report.
Comment 7 commit-hook freebsd_committer freebsd_triage 2023-11-05 13:11:04 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3f197bbce4da6ec6f860448653f4a2d2e9b25a11

commit 3f197bbce4da6ec6f860448653f4a2d2e9b25a11
Author:     Thierry Thomas <thierry@FreeBSD.org>
AuthorDate: 2023-11-05 13:07:18 +0000
Commit:     Thierry Thomas <thierry@FreeBSD.org>
CommitDate: 2023-11-05 13:07:18 +0000

    cad/opencascade: fix location of cmake files

    PR:             274834
    Reported by:    yuri

 cad/opencascade/Makefile  |  7 ++++++-
 cad/opencascade/pkg-plist | 34 +++++++++++++++++-----------------
 2 files changed, 23 insertions(+), 18 deletions(-)