[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 |
|
---|
[130] | 17 | set(PACPUS_USE_QT5 FALSE CACHE BOOL "Whether to use Qt5")
|
---|
| 18 | if(NOT PACPUS_USE_QT5)
|
---|
[119] | 19 | find_package(Qt4)
|
---|
| 20 | if(NOT QT4_FOUND)
|
---|
| 21 | message(WARNING "Qt4 not found try to find Qt5")
|
---|
[130] | 22 | set(PACPUS_USE_QT5 TRUE)
|
---|
[119] | 23 | endif()
|
---|
| 24 | endif()
|
---|
| 25 |
|
---|
[130] | 26 | if(PACPUS_USE_QT5)
|
---|
[127] | 27 | message(STATUS "Set CMake variable 'CMAKE_PREFIX_PATH' to the path like '%QT_BIN%/../lib/cmake'")
|
---|
[89] | 28 | # ========================================
|
---|
[127] | 29 | # All the Pacpus modules depend on Qt5
|
---|
[89] | 30 | # However, since each module requires specific Qt's modules, they have to include their own QT_USE_FILE
|
---|
| 31 | # ========================================
|
---|
| 32 |
|
---|
| 33 | # Tell CMake to run moc when necessary:
|
---|
| 34 | #set(CMAKE_AUTOMOC ON)
|
---|
| 35 | # As moc files are generated in the binary dir, tell CMake
|
---|
| 36 | # to always look for includes there:
|
---|
| 37 | set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
---|
| 38 |
|
---|
| 39 | find_package(Qt5Widgets REQUIRED)
|
---|
| 40 | find_package(Qt5Core REQUIRED)
|
---|
| 41 | find_package(Qt5Xml REQUIRED)
|
---|
| 42 | find_package(Qt5Gui REQUIRED)
|
---|
| 43 | find_package(Qt5OpenGL REQUIRED)
|
---|
| 44 | find_package(Qt5Network REQUIRED)
|
---|
[120] | 45 | find_package(Qt5SerialPort REQUIRED)
|
---|
[89] | 46 |
|
---|
| 47 | set(QT_DEFINITIONS
|
---|
[127] | 48 | ${Qt5Widgets_DEFINITIONS}
|
---|
| 49 | ${Qt5Core_DEFINITIONS}
|
---|
| 50 | ${Qt5Xml_DEFINITIONS}
|
---|
| 51 | ${Qt5Gui_DEFINITIONS}
|
---|
| 52 | ${Qt5OpenGL_DEFINITIONS}
|
---|
| 53 | ${Qt5Network_DEFINITIONS}
|
---|
| 54 | ${Qt5SerialPort_DEFINITIONS}
|
---|
[89] | 55 | )
|
---|
| 56 | set(QT_INCLUDE_DIR
|
---|
[127] | 57 | ${Qt5Widgets_INCLUDE_DIRS}
|
---|
| 58 | ${Qt5Core_INCLUDE_DIRS}
|
---|
| 59 | ${Qt5Xml_INCLUDE_DIRS}
|
---|
| 60 | ${Qt5Gui_INCLUDE_DIRS}
|
---|
| 61 | ${Qt5OpenGL_INCLUDE_DIRS}
|
---|
| 62 | ${Qt5Network_INCLUDE_DIRS}
|
---|
| 63 | ${Qt5SerialPort_INCLUDE_DIRS}
|
---|
[89] | 64 | )
|
---|
| 65 | set(QT_LIBRARIES
|
---|
[127] | 66 | ${Qt5Widgets_LIBRARIES}
|
---|
| 67 | ${Qt5Core_LIBRARIES}
|
---|
| 68 | ${Qt5Xml_LIBRARIES}
|
---|
| 69 | ${Qt5Gui_LIBRARIES}
|
---|
| 70 | ${Qt5OpenGL_LIBRARIES}
|
---|
| 71 | ${Qt5Network_LIBRARIES}
|
---|
| 72 | ${Qt5SerialPort_LIBRARIES}
|
---|
[89] | 73 | )
|
---|
| 74 |
|
---|
| 75 | if(Qt5_POSITION_INDEPENDENT_CODE)
|
---|
| 76 | set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
---|
| 77 | endif()
|
---|
| 78 |
|
---|
[130] | 79 | else()
|
---|
[119] | 80 |
|
---|
[89] | 81 | # ========================================
|
---|
[130] | 82 | # All the Pacpus modules depend on Qt4
|
---|
| 83 | # However, since each module requires specific Qt modules, they have to include their own QT_USE_FILE
|
---|
[119] | 84 | # ========================================
|
---|
| 85 | find_package(Qt4 REQUIRED)
|
---|
| 86 |
|
---|
[130] | 87 | endif()
|
---|
[119] | 88 |
|
---|
| 89 | # ========================================
|
---|
[89] | 90 | # Boost
|
---|
| 91 | # Do not use compiled modules, include-only headers.
|
---|
| 92 | # ========================================
|
---|
| 93 | if(PACPUS_USE_LOG)
|
---|
| 94 | list(APPEND PACPUS_DEFINITIONS " -DPACPUS_USE_LOG ")
|
---|
[141] | 95 | list(APPEND PACPUS_DEFINITIONS " -DBOOST_ALL_DYN_LINK ")
|
---|
| 96 |
|
---|
| 97 | find_package(Boost 1.54.0 REQUIRED
|
---|
| 98 | COMPONENTS
|
---|
| 99 | log
|
---|
[151] | 100 | log_setup
|
---|
[141] | 101 | )
|
---|
| 102 | include_directories(${Boost_INCLUDE_DIRS})
|
---|
| 103 | link_directories(${Boost_LIBRARY_DIRS})
|
---|
| 104 |
|
---|
| 105 | list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS})
|
---|
| 106 | list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES})
|
---|
[151] | 107 | #message("\${PACPUS_DEPENDENCIES_LIB} = ${PACPUS_DEPENDENCIES_LIB}")
|
---|
[89] | 108 | endif()
|
---|
| 109 |
|
---|
| 110 | # ========================================
|
---|
| 111 | # Doxygen
|
---|
| 112 | # ========================================
|
---|
| 113 | if(PACPUS_BUILD_DOC)
|
---|
| 114 | find_package(Doxygen)
|
---|
| 115 | if(NOT DOXYGEN_FOUND)
|
---|
| 116 | message(FATAL_ERROR "Doxygen is needed to build the documentation. Please install it correctly")
|
---|
| 117 | endif()
|
---|
| 118 | endif()
|
---|