Skip to content

Commit

Permalink
Fix a number of issues with the build system.
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-osman committed Sep 7, 2017
1 parent 2595bbe commit b8fdf51
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 7 deletions.
15 changes: 12 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ set(BIN_INSTALL_DIR bin CACHE STRING "Binary installation directory relative to
set(LIB_INSTALL_DIR lib CACHE STRING "Library installation directory relative to the install prefix")
set(INCLUDE_INSTALL_DIR include CACHE STRING "Header installation directory relative to the install prefix")

set(DOC_INSTALL_DIR share/doc/qmdnsengine CACHE STRING "Documentation installation directory relative to the install prefix")
set(EXAMPLES_INSTALL_DIR "${LIB_INSTALL_DIR}/qmdnsengine/examples" CACHE STRING "Examples installation directory relative to the install prefix")

find_package(Qt5Network 5.4 REQUIRED)

set(CMAKE_AUTOMOC ON)
Expand All @@ -40,9 +43,15 @@ if(BUILD_TESTS)
add_subdirectory(tests)
endif()

include(CPack)

set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}")
set(CPACK_PACKAGE_VENDOR "${PROJECT_AUTHOR}")
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})

set(CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "Documentation")
set(CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION "Documentation generated for the library")
set(CPACK_COMPONENT_EXAMPLES_DISPLAY_NAME "Examples")
set(CPACK_COMPONENT_EXAMPLES_DESCRIPTION "Sample applications using the library")

include(CPack)
5 changes: 5 additions & 0 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ configure_file(Doxyfile.in "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile")
add_custom_target(doc ALL
"${DOXYGEN_EXECUTABLE}" \"${CMAKE_CURRENT_BINARY_DIR}/Doxyfile\"
)

install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html"
DESTINATION "${DOC_INSTALL_DIR}"
COMPONENT documentation
)
17 changes: 13 additions & 4 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
if(Qt5Widgets_FOUND)
add_subdirectory(browser)
add_subdirectory(provider)
endif()
set(EXAMPLES
browser
provider
)

foreach(EXAMPLE ${EXAMPLES})
set(EXAMPLE_DIR "${EXAMPLES_INSTALL_DIR}/${EXAMPLE}")
add_subdirectory(${EXAMPLE})
install(DIRECTORY ${EXAMPLE}
DESTINATION "${EXAMPLES_INSTALL_DIR}"
COMPONENT examples
)
endforeach()
5 changes: 5 additions & 0 deletions examples/browser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ set_target_properties(browser PROPERTIES
)

target_link_libraries(browser qmdnsengine Qt5::Widgets)

install(TARGETS browser
RUNTIME DESTINATION "${EXAMPLE_DIR}"
COMPONENT examples
)
5 changes: 5 additions & 0 deletions examples/provider/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ set(SRC
add_executable(provider WIN32 ${SRC})

target_link_libraries(provider qmdnsengine Qt5::Widgets)

install(TARGETS provider
RUNTIME DESTINATION "${EXAMPLE_DIR}"
COMPONENT examples
)

0 comments on commit b8fdf51

Please sign in to comment.