1 | #################################################
|
---|
2 | # ___________ ____ ______ __ __ _____ #
|
---|
3 | # \____ \__ \ _/ ___\\____ \| | \/ ___/ #
|
---|
4 | # | |_> > __ \\ \___| |_> > | /\___ \ #
|
---|
5 | # | __(____ /\___ > __/|____//____ > #
|
---|
6 | # |__| \/ \/|__| \/ #
|
---|
7 | # #
|
---|
8 | #################################################
|
---|
9 |
|
---|
10 | ################################################################################
|
---|
11 | # OUTPUT
|
---|
12 | set(PACPUS_DEFINITIONS "")
|
---|
13 | set(PACPUS_DEPENDENCIES_INC "")
|
---|
14 | set(PACPUS_DEPENDENCIES_LIB "")
|
---|
15 |
|
---|
16 | ################################################################################
|
---|
17 | # Necessary for Qt5
|
---|
18 | # message(STATUS "Set CMake variable 'CMAKE_PREFIX_PATH' to the path like '%QT_BIN%/../lib/cmake'")
|
---|
19 | set(QT_CMAKE_DIR "$ENV{QT_BIN}/../lib/cmake")
|
---|
20 | get_filename_component(QT_CMAKE_DIR "${QT_CMAKE_DIR}" ABSOLUTE)
|
---|
21 | #message(STATUS "\${QT_CMAKE_DIR} = '${QT_CMAKE_DIR}'")
|
---|
22 | list(APPEND CMAKE_PREFIX_PATH
|
---|
23 | ${QT_CMAKE_DIR}
|
---|
24 | )
|
---|
25 | if(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 | )
|
---|
31 | endif()
|
---|
32 |
|
---|
33 | ################################################################################
|
---|
34 | # Find Qt
|
---|
35 | find_package(Qt5Widgets QUIET)
|
---|
36 | if(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}
|
---|
58 | )
|
---|
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)
|
---|
80 | endif()
|
---|
81 | else()
|
---|
82 | message(STATUS "Qt5 not found: try to find Qt4")
|
---|
83 |
|
---|
84 | find_package(Qt4 REQUIRED)
|
---|
85 | endif()
|
---|
86 |
|
---|
87 | ################################################################################
|
---|
88 | # All the Pacpus modules depend on Qt5
|
---|
89 | # However, since each module requires specific Qt's modules, they have to include their own QT_USE_FILE
|
---|
90 |
|
---|
91 | ################################################################################
|
---|
92 | # Boost
|
---|
93 | list(APPEND PACPUS_DEFINITIONS " -DBOOST_ALL_DYN_LINK ")
|
---|
94 | find_package(Boost 1.54.0
|
---|
95 | COMPONENTS
|
---|
96 | program_options
|
---|
97 | )
|
---|
98 | if(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})
|
---|
103 | endif()
|
---|
104 | if(PACPUS_USE_LOG)
|
---|
105 | list(APPEND PACPUS_DEFINITIONS " -DPACPUS_USE_LOG ")
|
---|
106 | find_package(Boost 1.54.0 REQUIRED
|
---|
107 | COMPONENTS
|
---|
108 | log
|
---|
109 | log_setup
|
---|
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})
|
---|
115 | endif()
|
---|
116 |
|
---|
117 | ################################################################################
|
---|
118 | # DOCUMENTATION
|
---|
119 | if(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()
|
---|
124 | endif()
|
---|