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

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

Fixed: Linux dependency to Boost.System resolved

  • Property svn:executable set to *
File size: 4.6 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 ")
108find_package(Boost 1.54.0
109 COMPONENTS
110 program_options #1.32.0
111)
112if(Boost_FOUND)
113 include_directories(${Boost_INCLUDE_DIRS})
114 link_directories(${Boost_LIBRARY_DIRS})
115 list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS})
116 list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES})
117endif()
118if(PACPUS_USE_LOG)
119 find_package(Boost 1.54.0 REQUIRED
120 COMPONENTS
121 #filesystem
122 log # 1.54.0
123 log_setup
124 system # needed on Linux
125 )
126 include_directories(${Boost_INCLUDE_DIRS})
127 link_directories(${Boost_LIBRARY_DIRS})
128 list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS})
129 list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES})
130endif()
131
132################################################################################
133# DOCUMENTATION
134if(PACPUS_BUILD_DOC)
135 find_package(Doxygen)
136 if(NOT DOXYGEN_FOUND)
137 message(FATAL_ERROR "Doxygen is needed to build the documentation. Please install it correctly")
138 endif()
139endif()
Note: See TracBrowser for help on using the repository browser.