I'm new to using CMake. I'm trying to create a simple CMakeList file and add support for QPrinter and QTextDocument from QT5 5.7. From what I've found ill have to add the following libraries to my CMakeList file:
- QT5Core
- QT5PrintSupport
- Qt5Gui
- Qt5Widgets
This is what i have right now:
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
PROJECT (photobooth)
find_package( Qt5Core )
find_package( Qt5PrintSupport )
find_package( Qt5Gui )
find_package( Qt5Widgets )
set( NAME_SRC
src/main.cpp
src/photobooth.cpp
)
set( NAME_HEADERS
include/photobooth.h
)
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/include )
link_directories( ${CMAKE_BINARY_DIR}/bin)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
add_executable( photobooth ${NAME_SRC} ${NAME_HEADERS} )
target_link_libraries( photobooth Qt5::Widgets )
target_link_libraries( photobooth Qt5::Core )
target_link_libraries( photobooth Qt5::Qt5PrintSupport )
target_link_libraries( photobooth Qt5::Qt5Gui )
This is the output from Cmake:
Configuring done
CMake Warning (dev) in CMakeLists.txt:
Policy CMP0020 is not set: Automatically link Qt executables to qtmain
target on Windows. Run "cmake --help-policy CMP0020" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in CMakeLists.txt:
Policy CMP0020 is not set: Automatically link Qt executables to qtmain
target on Windows. Run "cmake --help-policy CMP0020" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at CMakeLists.txt:24 (add_executable):
Policy CMP0028 is not set: Double colon in target name means ALIAS or
IMPORTED target. Run "cmake --help-policy CMP0028" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
Target "photobooth" links to target "Qt5::Qt5PrintSupport" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at CMakeLists.txt:24 (add_executable):
Policy CMP0028 is not set: Double colon in target name means ALIAS or
IMPORTED target. Run "cmake --help-policy CMP0028" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
Target "photobooth" links to target "Qt5::Qt5Gui" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in CMakeLists.txt:
Policy CMP0020 is not set: Automatically link Qt executables to qtmain
target on Windows. Run "cmake --help-policy CMP0020" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at CMakeLists.txt:24 (add_executable):
Policy CMP0028 is not set: Double colon in target name means ALIAS or
IMPORTED target. Run "cmake --help-policy CMP0028" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
Target "photobooth" links to target "Qt5::Qt5PrintSupport" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at CMakeLists.txt:24 (add_executable):
Policy CMP0028 is not set: Double colon in target name means ALIAS or
IMPORTED target. Run "cmake --help-policy CMP0028" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
Target "photobooth" links to target "Qt5::Qt5Gui" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in CMakeLists.txt:
Policy CMP0020 is not set: Automatically link Qt executables to qtmain
target on Windows. Run "cmake --help-policy CMP0020" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at CMakeLists.txt:24 (add_executable):
Policy CMP0028 is not set: Double colon in target name means ALIAS or
IMPORTED target. Run "cmake --help-policy CMP0028" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
Target "photobooth" links to target "Qt5::Qt5PrintSupport" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at CMakeLists.txt:24 (add_executable):
Policy CMP0028 is not set: Double colon in target name means ALIAS or
IMPORTED target. Run "cmake --help-policy CMP0028" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
Target "photobooth" links to target "Qt5::Qt5Gui" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in CMakeLists.txt:
Policy CMP0020 is not set: Automatically link Qt executables to qtmain
target on Windows. Run "cmake --help-policy CMP0020" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at CMakeLists.txt:24 (add_executable):
Policy CMP0028 is not set: Double colon in target name means ALIAS or
IMPORTED target. Run "cmake --help-policy CMP0028" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
Target "photobooth" links to target "Qt5::Qt5PrintSupport" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at CMakeLists.txt:24 (add_executable):
Policy CMP0028 is not set: Double colon in target name means ALIAS or
IMPORTED target. Run "cmake --help-policy CMP0028" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
Target "photobooth" links to target "Qt5::Qt5Gui" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in CMakeLists.txt:
Policy CMP0020 is not set: Automatically link Qt executables to qtmain
target on Windows. Run "cmake --help-policy CMP0020" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in CMakeLists.txt:
Policy CMP0020 is not set: Automatically link Qt executables to qtmain
target on Windows. Run "cmake --help-policy CMP0020" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in CMakeLists.txt:
Policy CMP0020 is not set: Automatically link Qt executables to qtmain
target on Windows. Run "cmake --help-policy CMP0020" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in CMakeLists.txt:
Policy CMP0020 is not set: Automatically link Qt executables to qtmain
target on Windows. Run "cmake --help-policy CMP0020" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at CMakeLists.txt:24 (add_executable):
Policy CMP0028 is not set: Double colon in target name means ALIAS or
IMPORTED target. Run "cmake --help-policy CMP0028" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
Target "photobooth" links to target "Qt5::Qt5PrintSupport" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at CMakeLists.txt:24 (add_executable):
Policy CMP0028 is not set: Double colon in target name means ALIAS or
IMPORTED target. Run "cmake --help-policy CMP0028" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
Target "photobooth" links to target "Qt5::Qt5Gui" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
This warning is for project developers. Use -Wno-dev to suppress it.
Generating done
My project generates fine with Visual Studio 14 2015 Win64 as my build. Also when i include QTextDocument in main.cpp it finds it but not QPrinter. Is there anything I'm doing incorrectly?