Please enable JavaScript to view this site.

IDS peak 2.8.0 / uEye+ firmware 3.33

Navigation: C: Programming with IDS peak > Creating a project

Notes on projects with Qt for Windows

Scroll Previous Top Next More

Notes for CMake

If you want to use CMake to open the samples of IDS peak or to create your own projects with Qt, the path to the CMake files of Qt must be specified. You find the description in the section below.

hint_info

If you use QtCreator, the following steps are not required, see Creating a project for Qt Creator with CMake.

Determining the correct path to Qt

Since Qt can have multiple installations as well as multiple compiler supports on a system at the same time, the correct path must be determined. If you use only one Qt version and only one compiler, the search is simplified.

1.Go to the Qt installation directory <Qt_DIR>. This can be e.g. C:/Qt.

2.Open the folder with the Qt version number <Qt_Version> to be used, e.g. 5.9.9.

3.Open the folder with the appropriate compiler name <Compiler>, e.g. msvc2017_64. For Visual Studio, the compilers are usually compatible, you could also choose an older compiler version than you actually want to use. For other compilers this is not necessarily valid. Therefore, make sure you choose the right compiler.

4.Next, go to the lib/cmake/Qt5 subfolders.

5.So copy the path found <Qt_DIR>/<Qt_Version>/<Compiler>/lib/cmake/Qt5/ e.g. C:/Qt/5.9.9/msvc2017_64/lib/cmake/Qt5/.

Customizing CMake configuration in the CMake GUI

If during configuration the directory Qt5_DIR is not found, enter the previously determined path in the text field and press "Configure" again.

Fig. 271: Customize CMake configuration

Fig. 271: Customize CMake configuration

Customizing CMakeLists.txt

If you open the CMake projects directly in the development environment, e.g. Visual Studio, you should enter the path directly in the CMakeLists.txt file in your project directory.

1.Open the CMakeLists.txt file in an editor.

2.Search for the string "find_package (Qt5" and append the HINTS command with the path found.

CMakeLists.txt

find_package (Qt5
   COMPONENTS
       Widgets Core Gui
   HINTS
       "C:/Qt/5.9.9/msvc2017_64/lib/cmake/Qt5/"
   REQUIRED
)

Customizing CMake settings in Visual Studio

Alternatively, you can use Visual Studio to set the Qt5_DIR variable for your project instead of manually editing CMakeLists.txt.

1.Open the project folder in Visual Studio. See Creating a project for Visual Studio with CMake.

2.Right-click CMakeLists.txt in project folder explorer > CMake settings for <project name>.

3.Search the CMake Variables and Cache list for the "Qt5_DIR" variable.

4.Enter the path found.

5.Save the file. CMake is automatically executed with the new settings and the project folder is re-created.

© 2024 IDS Imaging Development Systems GmbH