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

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

Experimental: using global logger object instead of trivial logger. Added: stub for colored log output on Linux.

  • Property svn:executable set to *
File size: 4.5 KB
RevLine 
[89]1#################################################
2# ___________ ____ ______ __ __ _____ #
3# \____ \__ \ _/ ___\\____ \| | \/ ___/ #
4# | |_> > __ \\ \___| |_> > | /\___ \ #
5# | __(____ /\___ > __/|____//____ > #
6# |__| \/ \/|__| \/ #
7# #
8#################################################
9
[187]10################################################################################
11# OUTPUT
[89]12set(PACPUS_DEPENDENCIES_INC "")
13set(PACPUS_DEPENDENCIES_LIB "")
14
[187]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)
[226]20if(DEBUG)
21 message(STATUS "\${QT_CMAKE_DIR} = '${QT_CMAKE_DIR}'")
22endif()
[187]23list(APPEND CMAKE_PREFIX_PATH
24 ${QT_CMAKE_DIR}
25)
26if(WIN32)
[226]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()
[187]35 list(APPEND CMAKE_PREFIX_PATH
[226]36 ${WINSDK_LIB}
[187]37 )
[119]38endif()
[226]39if(DEBUG)
40 message(STATUS "\${CMAKE_PREFIX_PATH} = '${CMAKE_PREFIX_PATH}'")
41endif()
[119]42
[187]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)
[234]56 #find_package(Qt5OpenGL REQUIRED)
57 #find_package(Qt5Network REQUIRED)
58 #find_package(Qt5SerialPort REQUIRED)
[187]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}
[175]68 )
[187]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)
[175]90 endif()
[187]91else()
92 message(STATUS "Qt5 not found: try to find Qt4")
93
[214]94 find_package(Qt4 REQUIRED QtCore QtGui QtXml)
95 include(${QT_USE_FILE})
[187]96endif()
97
98################################################################################
[127]99# All the Pacpus modules depend on Qt5
[89]100# However, since each module requires specific Qt's modules, they have to include their own QT_USE_FILE
101
[187]102################################################################################
103# Boost
104list(APPEND PACPUS_DEFINITIONS " -DBOOST_ALL_DYN_LINK ")
[223]105find_package(Boost 1.32.0
[187]106 COMPONENTS
107 program_options
[89]108)
[187]109if(Boost_FOUND)
110 include_directories(${Boost_INCLUDE_DIRS})
111 link_directories(${Boost_LIBRARY_DIRS})
112 list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS})
113 list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES})
[89]114endif()
115if(PACPUS_USE_LOG)
116 list(APPEND PACPUS_DEFINITIONS " -DPACPUS_USE_LOG ")
[141]117 find_package(Boost 1.54.0 REQUIRED
118 COMPONENTS
119 log
[151]120 log_setup
[236]121 system
[141]122 )
123 include_directories(${Boost_INCLUDE_DIRS})
124 link_directories(${Boost_LIBRARY_DIRS})
125 list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS})
126 list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES})
[89]127endif()
128
[187]129################################################################################
130# DOCUMENTATION
[89]131if(PACPUS_BUILD_DOC)
132 find_package(Doxygen)
133 if(NOT DOXYGEN_FOUND)
134 message(FATAL_ERROR "Doxygen is needed to build the documentation. Please install it correctly")
135 endif()
136endif()
Note: See TracBrowser for help on using the repository browser.