Changeset 187 in pacpusframework for trunk/cmake
- Timestamp:
- Oct 23, 2013, 10:58:40 AM (11 years ago)
- Location:
- trunk/cmake
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cmake/PacpusConfiguration.cmake
r163 r187 25 25 set(PACPUS_USE_SOLUTION_FOLDERS FALSE CACHE BOOL "Use solution folders to classify projects, works in MS Visual Studio") 26 26 27 set(QT5 FALSE CACHE BOOL " Use Qt5 or Qt4")28 29 27 if(PACPUS_USE_SOLUTION_FOLDERS) 30 28 if(CMAKE_VERSION VERSION_GREATER "2.8.0") -
trunk/cmake/PacpusDependencies.cmake
r178 r187 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 # FIXME: first find_package(Qt5Widgets QUIET), then Qt4 18 set(PACPUS_USE_QT5 FALSE CACHE BOOL "Whether to use Qt5") 19 if(NOT PACPUS_USE_QT5) 20 find_package(Qt4 QUIET) 21 if(NOT QT4_FOUND) 22 message(WARNING "Qt4 not found try to find Qt5") 23 set(PACPUS_USE_QT5 TRUE) 24 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 #message(STATUS "\${QT_CMAKE_DIR} = '${QT_CMAKE_DIR}'") 22 list(APPEND CMAKE_PREFIX_PATH 23 ${QT_CMAKE_DIR} 24 ) 25 if(WIN32) 26 message(STATUS "Environment variable 'WINSDK_LIB' should be set to something like 'C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86'") 27 #message(STATUS "\$ENV{WINSDK_LIB} = '$ENV{WINSDK_LIB}'") 28 list(APPEND CMAKE_PREFIX_PATH 29 $ENV{WINSDK_LIB} 30 ) 25 31 endif() 26 32 27 if(PACPUS_USE_QT5) 28 # message(STATUS "Set CMake variable 'CMAKE_PREFIX_PATH' to the path like '%QT_BIN%/../lib/cmake'") 29 set(QT_CMAKE_DIR "$ENV{QT_BIN}/../lib/cmake") 30 get_filename_component(QT_CMAKE_DIR "${QT_CMAKE_DIR}" ABSOLUTE) 31 message(STATUS "\${QT_CMAKE_DIR} = '${QT_CMAKE_DIR}'") 32 list(APPEND CMAKE_PREFIX_PATH 33 ${QT_CMAKE_DIR} 33 ################################################################################ 34 # Find Qt 35 find_package(Qt5Widgets QUIET) 36 if(Qt5Widgets_FOUND) 37 # Tell CMake to run moc when necessary: 38 #set(CMAKE_AUTOMOC ON) 39 # As moc files are generated in the binary dir, tell CMake 40 # to always look for includes there: 41 set(CMAKE_INCLUDE_CURRENT_DIR ON) 42 43 find_package(Qt5Core REQUIRED) 44 find_package(Qt5Xml REQUIRED) 45 find_package(Qt5Gui REQUIRED) 46 find_package(Qt5OpenGL REQUIRED) 47 find_package(Qt5Network REQUIRED) 48 find_package(Qt5SerialPort REQUIRED) 49 50 set(QT_DEFINITIONS 51 ${Qt5Widgets_DEFINITIONS} 52 ${Qt5Core_DEFINITIONS} 53 ${Qt5Xml_DEFINITIONS} 54 ${Qt5Gui_DEFINITIONS} 55 ${Qt5OpenGL_DEFINITIONS} 56 ${Qt5Network_DEFINITIONS} 57 ${Qt5SerialPort_DEFINITIONS} 34 58 ) 35 if(WIN32) 36 message(STATUS "Environment variable 'WINSDK_LIB' should be set to something like 'C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86'") 37 message(STATUS "\$ENV{WINSDK_LIB} = '$ENV{WINSDK_LIB}'") 38 list(APPEND CMAKE_PREFIX_PATH 39 $ENV{WINSDK_LIB} 40 ) 59 set(QT_INCLUDE_DIR 60 ${Qt5Widgets_INCLUDE_DIRS} 61 ${Qt5Core_INCLUDE_DIRS} 62 ${Qt5Xml_INCLUDE_DIRS} 63 ${Qt5Gui_INCLUDE_DIRS} 64 ${Qt5OpenGL_INCLUDE_DIRS} 65 ${Qt5Network_INCLUDE_DIRS} 66 ${Qt5SerialPort_INCLUDE_DIRS} 67 ) 68 set(QT_LIBRARIES 69 ${Qt5Widgets_LIBRARIES} 70 ${Qt5Core_LIBRARIES} 71 ${Qt5Xml_LIBRARIES} 72 ${Qt5Gui_LIBRARIES} 73 ${Qt5OpenGL_LIBRARIES} 74 ${Qt5Network_LIBRARIES} 75 ${Qt5SerialPort_LIBRARIES} 76 ) 77 78 if(Qt5_POSITION_INDEPENDENT_CODE) 79 set(CMAKE_POSITION_INDEPENDENT_CODE ON) 41 80 endif() 42 # ======================================== 81 else() 82 message(STATUS "Qt5 not found: try to find Qt4") 83 84 find_package(Qt4 REQUIRED) 85 endif() 86 87 ################################################################################ 43 88 # All the Pacpus modules depend on Qt5 44 89 # However, since each module requires specific Qt's modules, they have to include their own QT_USE_FILE 45 # ========================================46 90 47 # Tell CMake to run moc when necessary: 48 #set(CMAKE_AUTOMOC ON) 49 # As moc files are generated in the binary dir, tell CMake 50 # to always look for includes there: 51 set(CMAKE_INCLUDE_CURRENT_DIR ON) 52 53 find_package(Qt5Widgets REQUIRED) 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} 91 ################################################################################ 92 # Boost 93 list(APPEND PACPUS_DEFINITIONS " -DBOOST_ALL_DYN_LINK ") 94 find_package(Boost 1.54.0 95 COMPONENTS 96 program_options 69 97 ) 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) 98 if(Boost_FOUND) 99 include_directories(${Boost_INCLUDE_DIRS}) 100 link_directories(${Boost_LIBRARY_DIRS}) 101 list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS}) 102 list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES}) 91 103 endif() 92 93 else()94 95 # ========================================96 # All the Pacpus modules depend on Qt497 # However, since each module requires specific Qt modules, they have to include their own QT_USE_FILE98 # ========================================99 find_package(Qt4 REQUIRED)100 101 endif()102 103 # ========================================104 # Boost105 # Do not use compiled modules, include-only headers.106 # ========================================107 104 if(PACPUS_USE_LOG) 108 105 list(APPEND PACPUS_DEFINITIONS " -DPACPUS_USE_LOG ") 109 list(APPEND PACPUS_DEFINITIONS " -DBOOST_ALL_DYN_LINK ")110 111 106 find_package(Boost 1.54.0 REQUIRED 112 107 COMPONENTS 113 108 log 114 109 log_setup 115 program_options116 110 ) 117 111 include_directories(${Boost_INCLUDE_DIRS}) 118 112 link_directories(${Boost_LIBRARY_DIRS}) 119 120 113 list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS}) 121 114 list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES}) 122 #message("\${PACPUS_DEPENDENCIES_LIB} = ${PACPUS_DEPENDENCIES_LIB}")123 115 endif() 124 116 125 # ======================================== 126 # Doxygen 127 # ======================================== 117 ################################################################################ 118 # DOCUMENTATION 128 119 if(PACPUS_BUILD_DOC) 129 120 find_package(Doxygen) -
trunk/cmake/PacpusInstall.cmake
r185 r187 23 23 ${PACPUS_INCLUDE_DIR} 24 24 DESTINATION 25 ${PACPUS_INSTALL_DIR} /include25 ${PACPUS_INSTALL_DIR} 26 26 ) 27 27
Note:
See TracChangeset
for help on using the changeset viewer.