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

Last change on this file since 198 was 187, checked in by morasjul, 11 years ago

Fixed: towards Qt4/Qt5 compatibility.

  • Property svn:executable set to *
File size: 4.1 KB
RevLine 
[89]1#################################################
2# ___________ ____ ______ __ __ _____ #
3# \____ \__ \ _/ ___\\____ \| | \/ ___/ #
4# | |_> > __ \\ \___| |_> > | /\___ \ #
5# | __(____ /\___ > __/|____//____ > #
6# |__| \/ \/|__| \/ #
7# #
8#################################################
9
[187]10################################################################################
11# OUTPUT
[89]12set(PACPUS_DEFINITIONS "")
13set(PACPUS_DEPENDENCIES_INC "")
14set(PACPUS_DEPENDENCIES_LIB "")
15
[187]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 )
[119]31endif()
32
[187]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}
[175]58 )
[187]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)
[175]80 endif()
[187]81else()
82 message(STATUS "Qt5 not found: try to find Qt4")
83
84 find_package(Qt4 REQUIRED)
85endif()
86
87################################################################################
[127]88# All the Pacpus modules depend on Qt5
[89]89# However, since each module requires specific Qt's modules, they have to include their own QT_USE_FILE
90
[187]91################################################################################
92# Boost
93list(APPEND PACPUS_DEFINITIONS " -DBOOST_ALL_DYN_LINK ")
94find_package(Boost 1.54.0
95 COMPONENTS
96 program_options
[89]97)
[187]98if(Boost_FOUND)
99 include_directories(${Boost_INCLUDE_DIRS})
100 link_directories(${Boost_LIBRARY_DIRS})
101 list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS})
102 list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES})
[89]103endif()
104if(PACPUS_USE_LOG)
105 list(APPEND PACPUS_DEFINITIONS " -DPACPUS_USE_LOG ")
[141]106 find_package(Boost 1.54.0 REQUIRED
107 COMPONENTS
108 log
[151]109 log_setup
[141]110 )
111 include_directories(${Boost_INCLUDE_DIRS})
112 link_directories(${Boost_LIBRARY_DIRS})
113 list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS})
114 list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES})
[89]115endif()
116
[187]117################################################################################
118# DOCUMENTATION
[89]119if(PACPUS_BUILD_DOC)
120 find_package(Doxygen)
121 if(NOT DOXYGEN_FOUND)
122 message(FATAL_ERROR "Doxygen is needed to build the documentation. Please install it correctly")
123 endif()
124endif()
Note: See TracBrowser for help on using the repository browser.