This CMakeLists.txt file: > cmake_minimum_required(VERSION 3.12) > find_package(OpenCASCADE REQUIRED) fails to find OpenCASCADE: > $ cmake -DCMAKE_MODULE_PATH=/usr/local . > ...skipped... > CMake Error at CMakeLists.txt:10 (find_package): > By not providing "FindOpenCASCADE.cmake" in CMAKE_MODULE_PATH this project > has asked CMake to find a package configuration file provided by > "OpenCASCADE", but CMake did not find one. > > Could not find a package configuration file provided by "OpenCASCADE" with > any of the following names: > > OpenCASCADEConfig.cmake > opencascade-config.cmake > > Add the installation prefix of "OpenCASCADE" to CMAKE_PREFIX_PATH or set > "OpenCASCADE_DIR" to a directory containing one of the above files. If > "OpenCASCADE" provides a separate development package or SDK, be sure it > has been installed. opencascade-7.6.0_6 does install the file /usr/local/lib/cmake/OpenCASCADEConfig.cmake, I am not sure if -DCMAKE_MODULE_PATH=/usr/local is required, it probably isn't. There are at least 2 other ports that suffer from the same problem: science/axom and science/serac - they also install *.cmake files into lib/cmake. Why aren't these projects discovered by cmake? Is it wrong to place *.cmake files into lib/cmake? Should cmake be altered to look in lib/cmake?
(In reply to Yuri Victorovich from comment #0) Moin moin Given that the KDE ports also have their cmake files in lib/cmake, I'd say it is searched. :) You could try and run the configure stage with CMAKE_ARGS+=--trace to get some more details. mfg Tobias
(In reply to Tobias C. Berner from comment #1) Hi Tobias, The cmake's trace log doesn't say why did it fail to find opencascade. Log lines are mostly about cmake's initialization process. https://people.freebsd.org/~yuri/cmake-fails-to-find-cascade.log Best, Yuri
First off, OpenCASCADE (cad/opencascade) is installing its CMake Config files to the wrong place. Installing into ${LOCALBASE}/share/OpenCASCADE/ would make it "just work". Like rttr, ECM, and Eigen3. The right flag for debugging problems with finding packages using CMake is `--debug-find`, not `--trace`. Trace tells you what is executed, but it can't execute what it can't find. On the other hand, debug-find tells you where it looked, and why. There's a difference between *modules* (e.g. FindOpenCASCADE.cmake) and *config* (e.g. OpenCASCADEConfig.cmake). Different paths are used for searching. The error message you posted tells you that find *modules* are looked-for in the MODULE path, and that *configs* are looked-for in the PREFIX. It's not super-duper clear, not there and not in the help for `find_package()`, but if you follow the instructions: $ rm CMakeCache.txt ; cmake --debug-find . -DCMAKE_PREFIX_PATH=/usr/local/lib <snip lots of output> find_package considered the following locations for OpenCASCADE's Config module: /tmp/pr-266279/CMakeFiles/pkgRedirects/OpenCASCADEConfig.cmake /tmp/pr-266279/CMakeFiles/pkgRedirects/opencascade-config.cmake /usr/local/lib/OpenCASCADEConfig.cmake /usr/local/lib/opencascade-config.cmake /usr/local/lib/cmake/OpenCASCADEConfig.cmake The file was found at /usr/local/lib/cmake/OpenCASCADEConfig.cmake