0

I am working on MITK an opensource medical imaging software. For my project I need to use a MITK model fit plugin. In order to install this plugin, I need to change the build of the MITK software using cmake. When I am trying to do this I keep encountering the following error.


Forcing MITK_USE_Qt5 to ON because of MITK_USE_CTK
CMake Error at CMakeLists.txt:310 (find_package):
  Could not find a package configuration file provided by "Qt5" (requested
  version 5.12.9) with any of the following names:

    Qt5Config.cmake
    qt5-config.cmake

  Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
  to a directory containing one of the above files.  If "Qt5" provides a
  separate development package or SDK, be sure it has been installed.

I am new to CMAKE and QT frame works, any help would be very much appreciated

I tried adding QT5 location using environment variable, cache variable, tried using command prompt to run the same codes. I have not had any success so far. I keep getting the same error. C:\Qt - this is my Qt location. For CMAKE_PREFIX_PATH - C:\Qt\6.5.2\mingw_64\bin. I found a MITK QT5 configuration in the MITK source folder = "C:\MITK-master\CMake\PackageDepends\MITK_Qt5_Config.cmake". I was not able to find qt5config.cmake file within qt5 location.

  • My advice is to do exactly what the error message tells you in CMake-gui. – drescherjm Aug 15 '23 at 19:24
  • 1
    ***I tried adding QT5 location using environment variable, cache variable, tried using command prompt to run the same codes. I have not had any success so far.*** These should work. For help with that show your details and where the `Qt5Config.cmake` is located and what you tried. – drescherjm Aug 15 '23 at 19:26
  • Also make sure you have the proper Qt binaries for your compiler. MinGW binaries will not work for msvc or vise versa. – drescherjm Aug 15 '23 at 19:28
  • 1
    Would you please add where exactly your Qt is installed, and what exactly did you add to `CMAKE_PREFIX_PATH`? Otherwise all answers are wild guesses. – vre Aug 15 '23 at 19:54
  • `CMAKE_PREFIX_PATH` should be set to `C:\Qt\6.5.2\mingw_64`, i.e. to the root directory of your Qt installation. Make sure you use the mingw compiler. If you're trying to build with Visual Studio MSVC Compiler you need to install the appropriate Qt package. MingW and MSVC compiled libraries cannot be mixed. – vre Aug 16 '23 at 08:26
  • 1
    Just noticed you are trying to link a Qt6 to a lib that needs Qt5. This won't work. You need to provide a Qt5 package. – vre Aug 17 '23 at 08:20

0 Answers0