qt5base-lts/examples/widgets/painting/shared/CMakeLists.txt
Joerg Bornemann db25a067b0 Fix build of standalone painting examples
Since commit f5c69a5195 the examples/widgets/painting examples could
not be built standalone anymore.
Move the find_package calls out of the examples/widgets/painting/shared
subdirectory and add a .cmake file that can be included to use the
library conveniently.

Change-Id: I35cb5bd8419a67c782d109104c4a88d64477a8be
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-17 17:14:10 +02:00

27 lines
1.0 KiB
CMake

# special case skip regeneration
# Port of shared.pri to be included by painting examples
add_library(painting_shared OBJECT)
add_library(painting_shared::painting_shared ALIAS painting_shared)
qt6_wrap_cpp(moc_files arthurwidgets.h hoverpoints.h) # no automoc for OBJECT libs:-/
target_sources(painting_shared PRIVATE
arthurstyle.cpp arthurstyle.h
arthurwidgets.cpp arthurwidgets.h
hoverpoints.cpp hoverpoints.h
${moc_files}
)
target_link_libraries(painting_shared PUBLIC Qt::Widgets)
target_include_directories(painting_shared PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
## Scopes:
#####################################################################
if (TARGET Qt::OpenGL OR QT_FEATURE_opengles2)
target_compile_definitions(painting_shared PRIVATE QT_OPENGL_SUPPORT)
target_link_libraries(painting_shared PUBLIC
Qt::OpenGL
)
qt6_wrap_cpp(moc_files_gl fbopaintdevice.h) # no automoc for OBJECT libs
target_sources(painting_shared PRIVATE fbopaintdevice.cpp fbopaintdevice.h ${moc_files_gl})
endif()