source: pacpusframework/trunk/cmake/PacpusDependencies.cmake@ 214

Last change on this file since 214 was 214, checked in by Marek Kurdej, 11 years ago

Fixed: Qt4 dependency.

  • Property svn:executable set to *
File size: 4.2 KB
Line 
1#################################################
2# ___________ ____ ______ __ __ _____ #
3# \____ \__ \ _/ ___\\____ \| | \/ ___/ #
4# | |_> > __ \\ \___| |_> > | /\___ \ #
5# | __(____ /\___ > __/|____//____ > #
6# |__| \/ \/|__| \/ #
7# #
8#################################################
9
10################################################################################
11# OUTPUT
12set(PACPUS_DEFINITIONS "")
13set(PACPUS_DEPENDENCIES_INC "")
14set(PACPUS_DEPENDENCIES_LIB "")
15
16################################################################################
17# Necessary for Qt5
18# message(STATUS "Set CMake variable 'CMAKE_PREFIX_PATH' to the path like '%QT_BIN%/../lib/cmake'")
19set(QT_CMAKE_DIR "$ENV{QT_BIN}/../lib/cmake")
20get_filename_component(QT_CMAKE_DIR "${QT_CMAKE_DIR}" ABSOLUTE)
21#message(STATUS "\${QT_CMAKE_DIR} = '${QT_CMAKE_DIR}'")
22list(APPEND CMAKE_PREFIX_PATH
23 ${QT_CMAKE_DIR}
24)
25if(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 )
31endif()
32
33################################################################################
34# Find Qt
35find_package(Qt5Widgets QUIET)
36if(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}
58 )
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)
80 endif()
81else()
82 message(STATUS "Qt5 not found: try to find Qt4")
83
84 find_package(Qt4 REQUIRED QtCore QtGui QtXml)
85 include(${QT_USE_FILE})
86endif()
87
88################################################################################
89# All the Pacpus modules depend on Qt5
90# However, since each module requires specific Qt's modules, they have to include their own QT_USE_FILE
91
92################################################################################
93# Boost
94list(APPEND PACPUS_DEFINITIONS " -DBOOST_ALL_DYN_LINK ")
95find_package(Boost 1.54.0
96 COMPONENTS
97 program_options
98)
99if(Boost_FOUND)
100 include_directories(${Boost_INCLUDE_DIRS})
101 link_directories(${Boost_LIBRARY_DIRS})
102 list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS})
103 list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES})
104endif()
105if(PACPUS_USE_LOG)
106 list(APPEND PACPUS_DEFINITIONS " -DPACPUS_USE_LOG ")
107 find_package(Boost 1.54.0 REQUIRED
108 COMPONENTS
109 log
110 log_setup
111 )
112 include_directories(${Boost_INCLUDE_DIRS})
113 link_directories(${Boost_LIBRARY_DIRS})
114 list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS})
115 list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES})
116endif()
117
118################################################################################
119# DOCUMENTATION
120if(PACPUS_BUILD_DOC)
121 find_package(Doxygen)
122 if(NOT DOXYGEN_FOUND)
123 message(FATAL_ERROR "Doxygen is needed to build the documentation. Please install it correctly")
124 endif()
125endif()
Note: See TracBrowser for help on using the repository browser.