Could NOT find OpenCascade (missing: OPENCASCADE_LIBRARIES)

Hello, I am trying to compile OCP.

find_package_handle_standard_args( OpenCascade DEFAULT_MSG OPENCASCADE_LIBRARIES OPENCASCADE_INCLUDE_DIR )

I try using -DOPENCASCADE_LIBRARIES= …
but still I get the message.

With debugging everything etc I traced it down to:
/nix/store/mb3idi3441q1f5zvvi47cix10dbafdjd-cmake-3.20.5/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake|488| if(NOT ${_CURRENT_VAR} )

The cache file contains:
//No help, variable specified on the command line.
OPENCASCADE_LIBRARIES:UNINITIALIZED=/nix/store/m0fb47gw6naidy0zc9c6nsqd3y81h7n8-opencascade-occt-7.5.1

So it’s there ? I tried adding a type to the -D argument but failed. What am I missing ?

The LIBRARIES variables are usually local variables built up from other cache variable entries, so if this is the case, the cache variable is being shadowed by the local version.

Either way, a directory is not what _LIBRARIES is meant to be; it should probably be a list of library file paths, so your approach is basically trying to subvert the intention of the module, but it’s not working :slight_smile: .

I would suggest adding /nix/store/m0fb47gw6naidy0zc9c6nsqd3y81h7n8-opencascade-occt-7.5.1 to CMAKE_PREFIX_PATH either in the environment or to the cache variable (both work like PATH; the environment using : separators and the CMake variable using the ; list separators). This is likely to work much better.