Specifying multiple CMAKE_PREFIX_PATHs separated by semicolons on command line does not work

Hello List,

I am trying to specify multiple semicolon separated CMAKE_PREFIX_PATHs on the command line like so:

cmake -DCMAKE_PREFIX_PATH=/home/Olumide/src/project/Release/install/lib/cmake;/home/Olumide/src/project/Release/cmake .

Fortunately I am getting errors that suggest that cmake is only trying the second of the two paths.

cmake version: 3.19.1
OS: Ubuntu 18.04.5 LTS

Regards,

  • Olumide

You may need to quote your path list here, e.g. cmake -DCMAKE_PREFIX_PATH="/home/Olumide/src/project/Release/install/lib/cmake;/home/Olumide/src/project/Release/cmake" .

I’ve just tried

cmake -DCMAKE_PREFIX_PATH="/home/Olumide/src/Release/cmake;/home/Olumide/src/Release/install/lib/cmake" .

The resulting error suggests that the second path is not searched, e.g.

CMake Error at /home/Olumide/src/Release/cmake/SofaFrameworkConfig.cmake:99 (include):
  include could not find load file:

    /home/Olumide/src/Release/cmake/SofaFrameworkTargets.cmake
Call Stack (most recent call first):
  /home/Olumide/src/Release/cmake/SofaSimulationConfig.cmake:33 (find_package)
  CMakeLists.txt:4 (find_package)


CMake Error at /home/Olumide/src/Release/cmake/SofaFrameworkConfig.cmake:104 (include):
  include could not find load file:

    /home/Olumide/src/Release/cmake/SofaFrameworkTargets.cmake
Call Stack (most recent call first):
  /home/Olumide/src/Release/cmake/SofaSimulationConfig.cmake:33 (find_package)
  CMakeLists.txt:4 (find_package)


CMake Error at /home/Olumide/src/Release/cmake/SofaSimulationConfig.cmake:37 (include):
  include could not find load file:

    /home/Olumide/src/Release/cmake/SofaSimulationTargets.cmake
Call Stack (most recent call first):
  CMakeLists.txt:4 (find_package)

CMAKE_PREFIX_PATH should contain package base directories as you would specify for CMAKE_INSTALL_PREFIX when installing a package. As your given paths do not contain any strings like Sofa or SofaFramework I guess you’re providing the wrong directories to CMAKE_PREFIX_PATH. See the CMake documentation of the search procedure how a <prefix> directory is searched for config files.
Did you built and installed SofaFramework? Or are you running your commands on a build directory?