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

Last change on this file since 322 was 322, checked in by Marek Kurdej, 10 years ago

Clean finding WINSDK_LIB.

  • Property svn:executable set to *
File size: 5.1 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)
20message(STATUS "\${QT_CMAKE_DIR} = '${QT_CMAKE_DIR}'")
21list(APPEND CMAKE_PREFIX_PATH
22 ${QT_CMAKE_DIR}
23)
24if(WIN32)
25 set(WINSDK_LIB "$ENV{WINSDK_LIB}" CACHE PATH "Directory of Windows Development Kit, should contain glu32.lib.")
26 find_library(GLU32_LIB_PATH glu32 "${WINSDK_LIB}" "$ENV{WINSDK_LIB}")
27 get_filename_component(WINSDK_LIB "${GLU32_LIB_PATH}" DIRECTORY)
28 if("${WINSDK_LIB}" STREQUAL "")
29 message(STATUS "Environment variable 'WINSDK_LIB' should be set to the path containing glu32 library, e.g. 'C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86'")
30 else()
31 message(STATUS "\$ENV{WINSDK_LIB} = '$ENV{WINSDK_LIB}'")
32 message(STATUS "\${WINSDK_LIB} = '${WINSDK_LIB}'")
33 endif()
34 list(APPEND CMAKE_PREFIX_PATH
35 ${WINSDK_LIB}
36 )
37endif()
38if(DEBUG)
39 message(STATUS "\${CMAKE_PREFIX_PATH} = '${CMAKE_PREFIX_PATH}'")
40endif()
41
42################################################################################
43# Find Qt
44find_package(Qt5Widgets QUIET)
45if(Qt5Widgets_FOUND)
46 # Tell CMake to run moc when necessary:
47 #set(CMAKE_AUTOMOC ON)
48 # As moc files are generated in the binary dir, tell CMake
49 # to always look for includes there:
50 set(CMAKE_INCLUDE_CURRENT_DIR ON)
51
52 find_package(Qt5Core REQUIRED)
53 find_package(Qt5Xml REQUIRED)
54 find_package(Qt5Gui REQUIRED)
55 #find_package(Qt5OpenGL REQUIRED)
56 #find_package(Qt5Network REQUIRED)
57 #find_package(Qt5SerialPort REQUIRED)
58
59 set(QT_DEFINITIONS
60 ${Qt5Widgets_DEFINITIONS}
61 ${Qt5Core_DEFINITIONS}
62 ${Qt5Xml_DEFINITIONS}
63 ${Qt5Gui_DEFINITIONS}
64 ${Qt5OpenGL_DEFINITIONS}
65 ${Qt5Network_DEFINITIONS}
66 ${Qt5SerialPort_DEFINITIONS}
67 )
68 set(QT_INCLUDE_DIR
69 ${Qt5Widgets_INCLUDE_DIRS}
70 ${Qt5Core_INCLUDE_DIRS}
71 ${Qt5Xml_INCLUDE_DIRS}
72 ${Qt5Gui_INCLUDE_DIRS}
73 ${Qt5OpenGL_INCLUDE_DIRS}
74 ${Qt5Network_INCLUDE_DIRS}
75 ${Qt5SerialPort_INCLUDE_DIRS}
76 )
77 set(QT_LIBRARIES
78 ${Qt5Widgets_LIBRARIES}
79 ${Qt5Core_LIBRARIES}
80 ${Qt5Xml_LIBRARIES}
81 ${Qt5Gui_LIBRARIES}
82 ${Qt5OpenGL_LIBRARIES}
83 ${Qt5Network_LIBRARIES}
84 ${Qt5SerialPort_LIBRARIES}
85 )
86
87 if(Qt5_POSITION_INDEPENDENT_CODE)
88 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
89 endif()
90else()
91 message(STATUS "Qt5 not found: try to find Qt4")
92
93 find_package(Qt4 REQUIRED QtCore QtGui QtXml)
94 include(${QT_USE_FILE})
95endif()
96
97################################################################################
98# All the Pacpus modules depend on Qt5
99# However, since each module requires specific Qt's modules, they have to include their own QT_USE_FILE
100
101################################################################################
102# Boost
103set(Boost_USE_STATIC_LIBS OFF)
104set(Boost_USE_MULTITHREADED ON)
105set(Boost_USE_STATIC_RUNTIME OFF)
106list(APPEND PACPUS_DEFINITIONS " -DBOOST_ALL_DYN_LINK ")
107if(CMAKE_COMPILER_IS_GNUC)
108 list(APPEND PACPUS_DEFINITIONS " -lpthread ")
109endif()
110find_package(Boost 1.54.0
111 COMPONENTS
112 chrono # thread
113 date_time # thread
114 program_options #1.32.0
115 system # log, thread needed on Linux
116 thread
117)
118if(Boost_FOUND)
119 include_directories(${Boost_INCLUDE_DIRS})
120 link_directories(${Boost_LIBRARY_DIRS})
121 list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS})
122 list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES})
123endif()
124
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 list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS})
133 list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES})
134endif()
135if(PACPUS_BUILD_TESTS)
136 find_package(Boost 1.21.0 REQUIRED
137 COMPONENTS
138 unit_test_framework
139 )
140 list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS})
141 list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES})
142endif()
143
144################################################################################
145# DOCUMENTATION
146if(PACPUS_BUILD_DOC)
147 find_package(Doxygen)
148 if(NOT DOXYGEN_FOUND)
149 message(FATAL_ERROR "Doxygen is needed to build the documentation. Please install it correctly")
150 endif()
151endif()
Note: See TracBrowser for help on using the repository browser.