Changeset 229 in pacpusframework for branches/0.1.x/cmake/PacpusDependencies.cmake
- Timestamp:
- Nov 27, 2013, 12:42:10 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.1.x/cmake/PacpusDependencies.cmake
r151 r229 8 8 ################################################# 9 9 10 # ======================================== 11 # Output 12 # ======================================== 10 ################################################################################ 11 # OUTPUT 13 12 set(PACPUS_DEFINITIONS "") 14 13 set(PACPUS_DEPENDENCIES_INC "") 15 14 set(PACPUS_DEPENDENCIES_LIB "") 16 15 17 set(PACPUS_USE_QT5 FALSE CACHE BOOL "Whether to use Qt5") 18 if(NOT PACPUS_USE_QT5) 19 find_package(Qt4) 20 if(NOT QT4_FOUND) 21 message(WARNING "Qt4 not found try to find Qt5") 22 set(PACPUS_USE_QT5 TRUE) 23 endif() 16 ################################################################################ 17 # Necessary for Qt5 18 # message(STATUS "Set CMake variable 'CMAKE_PREFIX_PATH' to the path like '%QT_BIN%/../lib/cmake'") 19 set(QT_CMAKE_DIR "$ENV{QT_BIN}/../lib/cmake") 20 get_filename_component(QT_CMAKE_DIR "${QT_CMAKE_DIR}" ABSOLUTE) 21 if(DEBUG) 22 message(STATUS "\${QT_CMAKE_DIR} = '${QT_CMAKE_DIR}'") 23 endif() 24 list(APPEND CMAKE_PREFIX_PATH 25 ${QT_CMAKE_DIR} 26 ) 27 if(WIN32) 28 set(WINSDK_LIB "$ENV{WINSDK_LIB}" CACHE PATH "Directory of Windows Development Kit, should contain glu32.lib.") 29 if("${WINSDK_LIB}" STREQUAL "") 30 message(STATUS "Environment variable 'WINSDK_LIB' should be set to something like 'C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86'") 31 endif() 32 if(DEBUG) 33 message(STATUS "\$ENV{WINSDK_LIB} = '$ENV{WINSDK_LIB}'") 34 message(STATUS "\${WINSDK_LIB} = '${WINSDK_LIB}'") 35 endif() 36 list(APPEND CMAKE_PREFIX_PATH 37 ${WINSDK_LIB} 38 ) 39 endif() 40 if(DEBUG) 41 message(STATUS "\${CMAKE_PREFIX_PATH} = '${CMAKE_PREFIX_PATH}'") 24 42 endif() 25 43 26 if(PACPUS_USE_QT5) 27 message(STATUS "Set CMake variable 'CMAKE_PREFIX_PATH' to the path like '%QT_BIN%/../lib/cmake'") 28 # ======================================== 44 ################################################################################ 45 # Find Qt 46 find_package(Qt5Widgets QUIET) 47 if(Qt5Widgets_FOUND) 48 # Tell CMake to run moc when necessary: 49 #set(CMAKE_AUTOMOC ON) 50 # As moc files are generated in the binary dir, tell CMake 51 # to always look for includes there: 52 set(CMAKE_INCLUDE_CURRENT_DIR ON) 53 54 find_package(Qt5Core REQUIRED) 55 find_package(Qt5Xml REQUIRED) 56 find_package(Qt5Gui REQUIRED) 57 find_package(Qt5OpenGL REQUIRED) 58 find_package(Qt5Network REQUIRED) 59 find_package(Qt5SerialPort REQUIRED) 60 61 set(QT_DEFINITIONS 62 ${Qt5Widgets_DEFINITIONS} 63 ${Qt5Core_DEFINITIONS} 64 ${Qt5Xml_DEFINITIONS} 65 ${Qt5Gui_DEFINITIONS} 66 ${Qt5OpenGL_DEFINITIONS} 67 ${Qt5Network_DEFINITIONS} 68 ${Qt5SerialPort_DEFINITIONS} 69 ) 70 set(QT_INCLUDE_DIR 71 ${Qt5Widgets_INCLUDE_DIRS} 72 ${Qt5Core_INCLUDE_DIRS} 73 ${Qt5Xml_INCLUDE_DIRS} 74 ${Qt5Gui_INCLUDE_DIRS} 75 ${Qt5OpenGL_INCLUDE_DIRS} 76 ${Qt5Network_INCLUDE_DIRS} 77 ${Qt5SerialPort_INCLUDE_DIRS} 78 ) 79 set(QT_LIBRARIES 80 ${Qt5Widgets_LIBRARIES} 81 ${Qt5Core_LIBRARIES} 82 ${Qt5Xml_LIBRARIES} 83 ${Qt5Gui_LIBRARIES} 84 ${Qt5OpenGL_LIBRARIES} 85 ${Qt5Network_LIBRARIES} 86 ${Qt5SerialPort_LIBRARIES} 87 ) 88 89 if(Qt5_POSITION_INDEPENDENT_CODE) 90 set(CMAKE_POSITION_INDEPENDENT_CODE ON) 91 endif() 92 else() 93 message(STATUS "Qt5 not found: try to find Qt4") 94 95 find_package(Qt4 REQUIRED QtCore QtGui QtXml) 96 include(${QT_USE_FILE}) 97 endif() 98 99 ################################################################################ 29 100 # All the Pacpus modules depend on Qt5 30 101 # However, since each module requires specific Qt's modules, they have to include their own QT_USE_FILE 31 # ========================================32 102 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) 45 find_package(Qt5SerialPort REQUIRED) 46 47 set(QT_DEFINITIONS 48 ${Qt5Widgets_DEFINITIONS} 49 ${Qt5Core_DEFINITIONS} 50 ${Qt5Xml_DEFINITIONS} 51 ${Qt5Gui_DEFINITIONS} 52 ${Qt5OpenGL_DEFINITIONS} 53 ${Qt5Network_DEFINITIONS} 54 ${Qt5SerialPort_DEFINITIONS} 55 ) 56 set(QT_INCLUDE_DIR 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} 64 ) 65 set(QT_LIBRARIES 66 ${Qt5Widgets_LIBRARIES} 67 ${Qt5Core_LIBRARIES} 68 ${Qt5Xml_LIBRARIES} 69 ${Qt5Gui_LIBRARIES} 70 ${Qt5OpenGL_LIBRARIES} 71 ${Qt5Network_LIBRARIES} 72 ${Qt5SerialPort_LIBRARIES} 73 ) 74 75 if(Qt5_POSITION_INDEPENDENT_CODE) 76 set(CMAKE_POSITION_INDEPENDENT_CODE ON) 77 endif() 78 79 else() 80 81 # ======================================== 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 84 # ======================================== 85 find_package(Qt4 REQUIRED) 86 87 endif() 88 89 # ======================================== 103 ################################################################################ 90 104 # Boost 91 # Do not use compiled modules, include-only headers.92 # ========================================93 105 if(PACPUS_USE_LOG) 106 list(APPEND PACPUS_DEFINITIONS " -DBOOST_ALL_DYN_LINK ") 94 107 list(APPEND PACPUS_DEFINITIONS " -DPACPUS_USE_LOG ") 95 list(APPEND PACPUS_DEFINITIONS " -DBOOST_ALL_DYN_LINK ")96 97 108 find_package(Boost 1.54.0 REQUIRED 98 109 COMPONENTS … … 102 113 include_directories(${Boost_INCLUDE_DIRS}) 103 114 link_directories(${Boost_LIBRARY_DIRS}) 104 105 115 list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS}) 106 116 list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES}) 107 #message("\${PACPUS_DEPENDENCIES_LIB} = ${PACPUS_DEPENDENCIES_LIB}")108 117 endif() 109 118 110 # ======================================== 111 # Doxygen 112 # ======================================== 119 ################################################################################ 120 # DOCUMENTATION 113 121 if(PACPUS_BUILD_DOC) 114 122 find_package(Doxygen)
Note:
See TracChangeset
for help on using the changeset viewer.