[CMake] debugging CMAKE_PREFIX_PATH

Patrick Welche prlw1 at cam.ac.uk
Tue Sep 12 18:52:00 EDT 2017


Problematic (scribus) CMakeLists.txt:

  set(CMAKE_PREFIX_PATH "${QT_PREFIX}/lib/cmake")
  set(CMAKE_INCLUDE_CURRENT_DIR ON)
  find_package(Qt5Core ${QT_MIN_VERSION} REQUIRED)

On Tue, Sep 12, 2017 at 04:37:08PM +0300, Konstantin Tokarev wrote:
> What actually happens here: rogue CMake project overwrites
> user-supplied CMAKE_PREFIX_PATH with its own value, so it is
> disregarded.
>
> As a workaround (without changing project), you can pass
> -DQt5Core_DIR=/usr/pkg/qt5/lib/cmake/Qt5Core

Thank you! I had found the workaround, but the list of Qt packages
was becoming rather long. Getting rid of the CMAKE_PREFIX_PATH
over-ride fixed things, but then revealed a further problem:

  set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
  set(CAIRO_DIR ${CMAKE_MODULE_PATH})
  find_package(CAIRO REQUIRED)

  $ ls -1 CMakeLists.txt cmake/modules/CAIROConfig.cmake
  CMakeLists.txt
  cmake/modules/CAIROConfig.cmake

Any thoughts on this variation on the theme?


Cheers,

Patrick


More information about the CMake mailing list