Add CMake project for example

This commit is contained in:
Florian Meinicke
2020-09-11 09:34:23 +02:00
parent 3fdf9dd8d8
commit fe9d3cbc63
3 changed files with 32 additions and 0 deletions

View File

@ -144,3 +144,7 @@ install(TARGETS QtZeroConf
LIBRARY DESTINATION lib
PUBLIC_HEADER DESTINATION include/QtZeroConf
)
if(BUILD_EXAMPLE)
add_subdirectory(example)
endif()

View File

@ -34,6 +34,9 @@ QZeroConf can be built directly into your project if your project is [LGPL3](htt
Use `BUILD_SHARED_LIBS` to control whether QZeroConf should be built as static (`-DBUILD_SHARED_LIBS=OFF`) or as shared (`-DBUILD_SHARED_LIBS=ON`) library.
The default is `OFF`.
You can also build the included example project by setting `BUILD_EXAMPLE` to `ON`.
The default for this is `OFF`
### API
#### Service Publishing

25
example/CMakeLists.txt Normal file
View File

@ -0,0 +1,25 @@
project(QtZeroConfExample)
cmake_minimum_required(VERSION 2.8.11)
find_package(Qt5 COMPONENTS Gui Widgets REQUIRED)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
# Find QtZeroConf library if we're building standalone
if(NOT TARGET QtZeroConf)
find_package(QtZeroConf CONFIG REQUIRED)
endif()
add_executable(QtZeroConfExample
window.h
window.cpp
main.cpp
)
target_link_libraries(QtZeroConfExample
QtZeroConf
Qt5::Gui Qt5::Widgets
)