[89] | 1 | #################################################
|
---|
| 2 | # ___________ ____ ______ __ __ _____ #
|
---|
| 3 | # \____ \__ \ _/ ___\\____ \| | \/ ___/ #
|
---|
| 4 | # | |_> > __ \\ \___| |_> > | /\___ \ #
|
---|
| 5 | # | __(____ /\___ > __/|____//____ > #
|
---|
| 6 | # |__| \/ \/|__| \/ #
|
---|
| 7 | # #
|
---|
| 8 | #################################################
|
---|
| 9 |
|
---|
| 10 | # ========================================
|
---|
| 11 | # Output
|
---|
| 12 | # ========================================
|
---|
| 13 | set(PACPUS_DEFINITIONS "")
|
---|
| 14 | set(PACPUS_DEPENDENCIES_INC "")
|
---|
| 15 | set(PACPUS_DEPENDENCIES_LIB "")
|
---|
| 16 |
|
---|
[119] | 17 | if(NOT QT5)
|
---|
| 18 | find_package(Qt4)
|
---|
| 19 | if(NOT QT4_FOUND)
|
---|
| 20 | message(WARNING "Qt4 not found try to find Qt5")
|
---|
| 21 | set(QT5 TRUE)
|
---|
| 22 | endif()
|
---|
| 23 | endif()
|
---|
| 24 |
|
---|
| 25 | if(QT5)
|
---|
| 26 |
|
---|
[89] | 27 | # ========================================
|
---|
[92] | 28 | # All the Pacpus' modules depends from Qt5
|
---|
[89] | 29 | # However, since each module requires specific Qt's modules, they have to include their own QT_USE_FILE
|
---|
| 30 | # ========================================
|
---|
| 31 |
|
---|
| 32 | # Tell CMake to run moc when necessary:
|
---|
| 33 | #set(CMAKE_AUTOMOC ON)
|
---|
| 34 | # As moc files are generated in the binary dir, tell CMake
|
---|
| 35 | # to always look for includes there:
|
---|
| 36 | set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
---|
| 37 |
|
---|
| 38 | find_package(Qt5Widgets REQUIRED)
|
---|
| 39 | find_package(Qt5Core REQUIRED)
|
---|
| 40 | find_package(Qt5Xml REQUIRED)
|
---|
| 41 | find_package(Qt5Gui REQUIRED)
|
---|
| 42 | find_package(Qt5OpenGL REQUIRED)
|
---|
| 43 | find_package(Qt5Network REQUIRED)
|
---|
[120] | 44 | find_package(Qt5SerialPort REQUIRED)
|
---|
[89] | 45 |
|
---|
| 46 | set(QT_DEFINITIONS
|
---|
| 47 | ${Qt5Widgets_DEFINITIONS}
|
---|
| 48 | ${Qt5Core_DEFINITIONS}
|
---|
| 49 | ${Qt5Xml_DEFINITIONS}
|
---|
| 50 | ${Qt5Gui_DEFINITIONS}
|
---|
| 51 | ${Qt5OpenGL_DEFINITIONS}
|
---|
| 52 | ${Qt5Network_DEFINITIONS}
|
---|
[120] | 53 | ${Qt5SerialPort_DEFINITIONS}
|
---|
[89] | 54 | )
|
---|
| 55 | set(QT_INCLUDE_DIR
|
---|
| 56 | ${Qt5Widgets_INCLUDE_DIRS}
|
---|
| 57 | ${Qt5Core_INCLUDE_DIRS}
|
---|
| 58 | ${Qt5Xml_INCLUDE_DIRS}
|
---|
| 59 | ${Qt5Gui_INCLUDE_DIRS}
|
---|
| 60 | ${Qt5OpenGL_INCLUDE_DIRS}
|
---|
| 61 | ${Qt5Network_INCLUDE_DIRS}
|
---|
[120] | 62 | ${Qt5SerialPort_INCLUDE_DIRS}
|
---|
[89] | 63 | )
|
---|
| 64 |
|
---|
| 65 | set(QT_LIBRARIES
|
---|
| 66 | ${Qt5Widgets_LIBRARIES}
|
---|
| 67 | ${Qt5Core_LIBRARIES}
|
---|
| 68 | ${Qt5Xml_LIBRARIES}
|
---|
| 69 | ${Qt5Gui_LIBRARIES}
|
---|
| 70 | ${Qt5OpenGL_LIBRARIES}
|
---|
| 71 | ${Qt5Network_LIBRARIES}
|
---|
[120] | 72 | ${Qt5SerialPort_LIBRARIES}
|
---|
[89] | 73 | )
|
---|
| 74 |
|
---|
| 75 | if(Qt5_POSITION_INDEPENDENT_CODE)
|
---|
| 76 | set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
---|
| 77 | endif()
|
---|
| 78 |
|
---|
[119] | 79 | else(QT5)
|
---|
| 80 |
|
---|
[89] | 81 | # ========================================
|
---|
[119] | 82 | # All the Pacpus' modules depends from Qt4
|
---|
| 83 | # However, since each module requires specific Qt's modules, they have to include their own QT_USE_FILE
|
---|
| 84 | # ========================================
|
---|
| 85 | find_package(Qt4 REQUIRED)
|
---|
| 86 |
|
---|
| 87 | endif(QT5)
|
---|
| 88 |
|
---|
| 89 | # ========================================
|
---|
[89] | 90 | # Boost
|
---|
| 91 | # Do not use compiled modules, include-only headers.
|
---|
| 92 | # ========================================
|
---|
| 93 | #find_package(Boost 1.49.0 REQUIRED)
|
---|
| 94 | #list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS})
|
---|
| 95 |
|
---|
| 96 | # ========================================
|
---|
| 97 | # log4cxx
|
---|
| 98 | # ========================================
|
---|
| 99 | if(PACPUS_USE_LOG)
|
---|
| 100 |
|
---|
| 101 | if(WIN32 AND MSVC AND IS_BUILDING_PACPUS)
|
---|
| 102 | set(LOG4CXX_ROOT ${PACPUS_3RD_PARTY_DIR}/apache-log4cxx)
|
---|
| 103 | endif()
|
---|
| 104 |
|
---|
| 105 | find_package(log4cxx REQUIRED)
|
---|
| 106 |
|
---|
| 107 | list(APPEND PACPUS_DEFINITIONS " -DPACPUS_USE_LOG ")
|
---|
| 108 | list(APPEND PACPUS_DEPENDENCIES_INC ${LOG4CXX_INCLUDE_DIRS})
|
---|
| 109 | list(APPEND PACPUS_DEPENDENCIES_LIB ${LOG4CXX_LIBRARIES})
|
---|
| 110 |
|
---|
| 111 | # If needed, install the dll of log4cxx
|
---|
| 112 | if(WIN32 AND MSVC AND IS_BUILDING_PACPUS)
|
---|
| 113 | pacpus_get_msvc(MSVC_VERSION)
|
---|
| 114 | pacpus_purge_backslash(LOG4CXX_ROOT)
|
---|
| 115 |
|
---|
| 116 | install(
|
---|
| 117 | FILES
|
---|
| 118 | ${LOG4CXX_ROOT}/bin/${MSVC_VERSION}/log4cxx.dll
|
---|
| 119 | ${LOG4CXX_ROOT}/bin/${MSVC_VERSION}/log4cxx_d.dll
|
---|
| 120 | DESTINATION
|
---|
| 121 | ${PACPUS_INSTALL_DIR}/bin
|
---|
| 122 | )
|
---|
| 123 | endif()
|
---|
| 124 | endif()
|
---|
| 125 |
|
---|
| 126 | # ========================================
|
---|
| 127 | # Doxygen
|
---|
| 128 | # ========================================
|
---|
| 129 | if(PACPUS_BUILD_DOC)
|
---|
| 130 | find_package(Doxygen)
|
---|
| 131 | if(NOT DOXYGEN_FOUND)
|
---|
| 132 | message(FATAL_ERROR "Doxygen is needed to build the documentation. Please install it correctly")
|
---|
| 133 | endif()
|
---|
| 134 | endif()
|
---|