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

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

Added: dependencies from Boost.Thread

  • Property svn:executable set to *
File size: 4.8 KB
Line 
1#################################################
2# ___________ ____ ______ __ __ _____ #
3# \____ \__ \ _/ ___\\____ \| | \/ ___/ #
4# | |_> > __ \\ \___| |_> > | /\___ \ #
5# | __(____ /\___ > __/|____//____ > #
6# |__| \/ \/|__| \/ #
7# #
8#################################################
9
10################################################################################
11# OUTPUT
12set(PACPUS_DEPENDENCIES_INC "")
13set(PACPUS_DEPENDENCIES_LIB "")
14
15################################################################################
16# Necessary for Qt5
17# message(STATUS "Set CMake variable 'CMAKE_PREFIX_PATH' to the path like '%QT_BIN%/../lib/cmake'")
18set(QT_CMAKE_DIR "$ENV{QT_BIN}/../lib/cmake")
19get_filename_component(QT_CMAKE_DIR "${QT_CMAKE_DIR}" ABSOLUTE)
20if(DEBUG)
21 message(STATUS "\${QT_CMAKE_DIR} = '${QT_CMAKE_DIR}'")
22endif()
23list(APPEND CMAKE_PREFIX_PATH
24 ${QT_CMAKE_DIR}
25)
26if(WIN32)
27 set(WINSDK_LIB "$ENV{WINSDK_LIB}" CACHE PATH "Directory of Windows Development Kit, should contain glu32.lib.")
28 if("${WINSDK_LIB}" STREQUAL "")
29 message(STATUS "Environment variable 'WINSDK_LIB' should be set to something like 'C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86'")
30 endif()
31 if(DEBUG)
32 message(STATUS "\$ENV{WINSDK_LIB} = '$ENV{WINSDK_LIB}'")
33 message(STATUS "\${WINSDK_LIB} = '${WINSDK_LIB}'")
34 endif()
35 list(APPEND CMAKE_PREFIX_PATH
36 ${WINSDK_LIB}
37 )
38endif()
39if(DEBUG)
40 message(STATUS "\${CMAKE_PREFIX_PATH} = '${CMAKE_PREFIX_PATH}'")
41endif()
42
43################################################################################
44# Find Qt
45find_package(Qt5Widgets QUIET)
46if(Qt5Widgets_FOUND)
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(Qt5Core REQUIRED)
54 find_package(Qt5Xml REQUIRED)
55 find_package(Qt5Gui REQUIRED)
56 #find_package(Qt5OpenGL REQUIRED)
57 #find_package(Qt5Network REQUIRED)
58 #find_package(Qt5SerialPort REQUIRED)
59
60 set(QT_DEFINITIONS
61 ${Qt5Widgets_DEFINITIONS}
62 ${Qt5Core_DEFINITIONS}
63 ${Qt5Xml_DEFINITIONS}
64 ${Qt5Gui_DEFINITIONS}
65 ${Qt5OpenGL_DEFINITIONS}
66 ${Qt5Network_DEFINITIONS}
67 ${Qt5SerialPort_DEFINITIONS}
68 )
69 set(QT_INCLUDE_DIR
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}
77 )
78 set(QT_LIBRARIES
79 ${Qt5Widgets_LIBRARIES}
80 ${Qt5Core_LIBRARIES}
81 ${Qt5Xml_LIBRARIES}
82 ${Qt5Gui_LIBRARIES}
83 ${Qt5OpenGL_LIBRARIES}
84 ${Qt5Network_LIBRARIES}
85 ${Qt5SerialPort_LIBRARIES}
86 )
87
88 if(Qt5_POSITION_INDEPENDENT_CODE)
89 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
90 endif()
91else()
92 message(STATUS "Qt5 not found: try to find Qt4")
93
94 find_package(Qt4 REQUIRED QtCore QtGui QtXml)
95 include(${QT_USE_FILE})
96endif()
97
98################################################################################
99# All the Pacpus modules depend on Qt5
100# However, since each module requires specific Qt's modules, they have to include their own QT_USE_FILE
101
102################################################################################
103# Boost
104set(Boost_USE_STATIC_LIBS OFF)
105set(Boost_USE_MULTITHREADED ON)
106set(Boost_USE_STATIC_RUNTIME OFF)
107list(APPEND PACPUS_DEFINITIONS " -DBOOST_ALL_DYN_LINK ")
108if(CMAKE_COMPILER_IS_GNUC)
109 list(APPEND PACPUS_DEFINITIONS " -lpthread ")
110endif()
111find_package(Boost 1.54.0
112 COMPONENTS
113 chrono # thread
114 date_time # thread
115 program_options #1.32.0
116 system # log, thread needed on Linux
117 thread
118)
119if(Boost_FOUND)
120 include_directories(${Boost_INCLUDE_DIRS})
121 link_directories(${Boost_LIBRARY_DIRS})
122 list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS})
123 list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES})
124endif()
125if(PACPUS_USE_LOG)
126 find_package(Boost 1.54.0 REQUIRED
127 COMPONENTS
128 #filesystem
129 log # 1.54.0
130 log_setup # log
131 )
132 include_directories(${Boost_INCLUDE_DIRS})
133 link_directories(${Boost_LIBRARY_DIRS})
134 list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS})
135 list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES})
136endif()
137
138################################################################################
139# DOCUMENTATION
140if(PACPUS_BUILD_DOC)
141 find_package(Doxygen)
142 if(NOT DOXYGEN_FOUND)
143 message(FATAL_ERROR "Doxygen is needed to build the documentation. Please install it correctly")
144 endif()
145endif()
Note: See TracBrowser for help on using the repository browser.