diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d376ef..d011663 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,18 +1,10 @@ cmake_minimum_required(VERSION 2.8.11) -project(qhttpengine) +project(QHttpEngine) if(NOT (CMAKE_MAJOR_VERSION VERSION_LESS 3)) cmake_policy(SET CMP0043 OLD) endif() -option(BUILD_DOC "Build Doxygen documentation" OFF) -option(BUILD_EXAMPLES "Build the example applications" OFF) -option(BUILD_TESTS "Build the test suite" OFF) - -set(LIB_INSTALL_DIR lib CACHE STRING "Library installation directory") -set(INCLUDE_INSTALL_DIR include CACHE STRING "Header installation directory") -set(CMAKECONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME}" CACHE STRING "CMake configuration installation directory") - set(PROJECT_NAME "QHttpEngine") set(PROJECT_DESCRIPTION "Simple and secure HTTP server for Qt applications") set(PROJECT_AUTHOR "Nathan Osman") @@ -23,6 +15,17 @@ set(PROJECT_VERSION_MINOR 1) set(PROJECT_VERSION_PATCH 0) set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") +option(BUILD_DOC "Build Doxygen documentation" OFF) +option(BUILD_EXAMPLES "Build the example applications" OFF) +option(BUILD_TESTS "Build the test suite" OFF) + +set(BIN_INSTALL_DIR bin CACHE STRING "Binary runtime installation directory relative to the install prefix") +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(CMAKECONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME}" CACHE STRING "CMake configuration installation directory") +set(DOC_INSTALL_DIR share/doc/${PROJECT_NAME} CACHE STRING "Documentation installation directory relative to the install prefix") +set(EXAMPLES_INSTALL_DIR "${LIB_INSTALL_DIR}/${PROJECT_NAME}/examples") + find_package(Qt5Network 5.1 REQUIRED) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 318d3f2..f0c0e80 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -3,9 +3,9 @@ find_package(Doxygen REQUIRED) configure_file(Doxyfile.in "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile") add_custom_target(doc ALL - doxygen "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" + "${DOXYGEN_EXECUTABLE}" "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" ) install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html" - DESTINATION share/doc/qhttpengine + DESTINATION "${DOC_INSTALL_DIR}" ) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 4b7c157..03941e0 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,5 +1,3 @@ -set(EXAMPLES_INSTALL_DIR "${LIB_INSTALL_DIR}/${PROJECT_NAME}/examples") - set(EXAMPLES chatserver fileserver diff --git a/examples/chatserver/CMakeLists.txt b/examples/chatserver/CMakeLists.txt index f836b3a..be9e31d 100644 --- a/examples/chatserver/CMakeLists.txt +++ b/examples/chatserver/CMakeLists.txt @@ -6,7 +6,7 @@ set(SRC qt5_add_resources(QRC resources.qrc) add_executable(chatserver ${SRC} ${QRC}) -target_link_libraries(chatserver qhttpengine) +target_link_libraries(chatserver QHttpEngine) set_target_properties(chatserver PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}" ) diff --git a/examples/fileserver/CMakeLists.txt b/examples/fileserver/CMakeLists.txt index 34b267d..11423c2 100644 --- a/examples/fileserver/CMakeLists.txt +++ b/examples/fileserver/CMakeLists.txt @@ -3,7 +3,7 @@ set(SRC ) add_executable(fileserver ${SRC}) -target_link_libraries(fileserver qhttpengine) +target_link_libraries(fileserver QHttpEngine) set_target_properties(fileserver PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}" ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6d9dacc..9ea29ce 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,41 +16,37 @@ set(SRC ) if(WIN32) - set(OUTPUT_NAME ${PROJECT_NAME}${PROJECT_VERSION_MAJOR}) configure_file(resource.rc.in "${CMAKE_CURRENT_BINARY_DIR}/resource.rc") set(SRC ${SRC} "${CMAKE_CURRENT_BINARY_DIR}/resource.rc") -else() - set(OUTPUT_NAME ${PROJECT_NAME}) endif() -add_library(qhttpengine SHARED ${HEADERS} ${SRC}) -qt5_use_modules(qhttpengine Network) +add_library(QHttpEngine SHARED ${HEADERS} ${SRC}) +qt5_use_modules(QHttpEngine Network) -target_include_directories(qhttpengine PUBLIC +target_include_directories(QHttpEngine PUBLIC "$" "$" "$" ) -set_target_properties(qhttpengine PROPERTIES +set_target_properties(QHttpEngine PROPERTIES DEFINE_SYMBOL QT_NO_SIGNALS_SLOTS_KEYWORDS DEFINE_SYMBOL QHTTPENGINE_LIBRARY PUBLIC_HEADER "${HEADERS}" - OUTPUT_NAME ${OUTPUT_NAME} VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}" LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}" ) -install(TARGETS qhttpengine EXPORT qhttpengine-export - RUNTIME DESTINATION bin +install(TARGETS QHttpEngine EXPORT QHttpEngine-export + RUNTIME DESTINATION "${BIN_INSTALL_DIR}" LIBRARY DESTINATION "${LIB_INSTALL_DIR}" ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" PUBLIC_HEADER DESTINATION "${INCLUDE_INSTALL_DIR}/${PROJECT_NAME}" ) -install(EXPORT qhttpengine-export DESTINATION "${CMAKECONFIG_INSTALL_DIR}" +install(EXPORT QHttpEngine-export DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE ${PROJECT_NAME}Config.cmake ) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 36e9b9f..4435098 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -19,7 +19,7 @@ foreach(TEST ${TESTS}) add_executable(${NAME} "${TEST}") qt5_use_modules(${NAME} Test) - target_link_libraries(${NAME} qhttpengine common) + target_link_libraries(${NAME} QHttpEngine common) set_target_properties(${NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}" ) diff --git a/tests/common/CMakeLists.txt b/tests/common/CMakeLists.txt index 6b21040..5e58d40 100644 --- a/tests/common/CMakeLists.txt +++ b/tests/common/CMakeLists.txt @@ -4,6 +4,6 @@ set(SRC ) add_library(common STATIC ${SRC}) -target_link_libraries(common qhttpengine) +target_link_libraries(common QHttpEngine) qt5_use_modules(common Network)