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