I'm using Windows and I want to create a CMakeLists.txt
that allows me to build a Qt application.
I've installed Qt in a folder that's not present in PATH
enviornment variable and I want to specify the folder when I invoke CMake.
I want to create a variable that can be set when CMake is invoked from both command line and gui, when I set the Qt library path. With this I can run CMake and compile project with Qt stored in any folder. How can I do it?
This is my CMakeFile:
cmake_minimum_required (VERSION 3.0)
project (myproject)
set (project_name myproject)
set (project_major_version 0)
set (project_minor_version 1)
set (project_fix_version 0)
set (project_version ${project_major_version}.${project_minor_version}.${project_fix_version})
set (output_dir "build")
# Source files
include_directories (${cmake_current_source_dir})
file (GLOB project_src "*.cpp")
# Project settings
set (cmake_automoc on)
find_package (qt5widgets)
add_executable (myproject ${project_src})
target_link_libraries (${project_name} qt5::widgets)