source: pacpusframework/branches/2.0-beta1/cmake/PacpusDependencies.cmake@ 119

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

add Qt4 compatibility

  • Property svn:executable set to *
File size: 3.6 KB
Line 
1#################################################
2# ___________ ____ ______ __ __ _____ #
3# \____ \__ \ _/ ___\\____ \| | \/ ___/ #
4# | |_> > __ \\ \___| |_> > | /\___ \ #
5# | __(____ /\___ > __/|____//____ > #
6# |__| \/ \/|__| \/ #
7# #
8#################################################
9
10# ========================================
11# Output
12# ========================================
13set(PACPUS_DEFINITIONS "")
14set(PACPUS_DEPENDENCIES_INC "")
15set(PACPUS_DEPENDENCIES_LIB "")
16
17if(NOT QT5)
18 find_package(Qt4)
19 if(NOT QT4_FOUND)
20 message(WARNING "Qt4 not found try to find Qt5")
21 set(QT5 TRUE)
22 endif()
23endif()
24
25if(QT5)
26
27# ========================================
28# All the Pacpus' modules depends from Qt5
29# However, since each module requires specific Qt's modules, they have to include their own QT_USE_FILE
30# ========================================
31
32# Tell CMake to run moc when necessary:
33#set(CMAKE_AUTOMOC ON)
34# As moc files are generated in the binary dir, tell CMake
35# to always look for includes there:
36set(CMAKE_INCLUDE_CURRENT_DIR ON)
37
38find_package(Qt5Widgets REQUIRED)
39find_package(Qt5Core REQUIRED)
40find_package(Qt5Xml REQUIRED)
41find_package(Qt5Gui REQUIRED)
42find_package(Qt5OpenGL REQUIRED)
43find_package(Qt5Network REQUIRED)
44
45set(QT_DEFINITIONS
46${Qt5Widgets_DEFINITIONS}
47${Qt5Core_DEFINITIONS}
48${Qt5Xml_DEFINITIONS}
49${Qt5Gui_DEFINITIONS}
50${Qt5OpenGL_DEFINITIONS}
51${Qt5Network_DEFINITIONS}
52)
53set(QT_INCLUDE_DIR
54${Qt5Widgets_INCLUDE_DIRS}
55${Qt5Core_INCLUDE_DIRS}
56${Qt5Xml_INCLUDE_DIRS}
57${Qt5Gui_INCLUDE_DIRS}
58${Qt5OpenGL_INCLUDE_DIRS}
59${Qt5Network_INCLUDE_DIRS}
60)
61
62set(QT_LIBRARIES
63${Qt5Widgets_LIBRARIES}
64${Qt5Core_LIBRARIES}
65${Qt5Xml_LIBRARIES}
66${Qt5Gui_LIBRARIES}
67${Qt5OpenGL_LIBRARIES}
68${Qt5Network_LIBRARIES}
69)
70
71if(Qt5_POSITION_INDEPENDENT_CODE)
72 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
73endif()
74
75else(QT5)
76
77# ========================================
78# All the Pacpus' modules depends from Qt4
79# However, since each module requires specific Qt's modules, they have to include their own QT_USE_FILE
80# ========================================
81find_package(Qt4 REQUIRED)
82
83endif(QT5)
84
85# ========================================
86# Boost
87# Do not use compiled modules, include-only headers.
88# ========================================
89#find_package(Boost 1.49.0 REQUIRED)
90#list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS})
91
92# ========================================
93# log4cxx
94# ========================================
95if(PACPUS_USE_LOG)
96
97 if(WIN32 AND MSVC AND IS_BUILDING_PACPUS)
98 set(LOG4CXX_ROOT ${PACPUS_3RD_PARTY_DIR}/apache-log4cxx)
99 endif()
100
101 find_package(log4cxx REQUIRED)
102
103 list(APPEND PACPUS_DEFINITIONS " -DPACPUS_USE_LOG ")
104 list(APPEND PACPUS_DEPENDENCIES_INC ${LOG4CXX_INCLUDE_DIRS})
105 list(APPEND PACPUS_DEPENDENCIES_LIB ${LOG4CXX_LIBRARIES})
106
107 # If needed, install the dll of log4cxx
108 if(WIN32 AND MSVC AND IS_BUILDING_PACPUS)
109 pacpus_get_msvc(MSVC_VERSION)
110 pacpus_purge_backslash(LOG4CXX_ROOT)
111
112 install(
113 FILES
114 ${LOG4CXX_ROOT}/bin/${MSVC_VERSION}/log4cxx.dll
115 ${LOG4CXX_ROOT}/bin/${MSVC_VERSION}/log4cxx_d.dll
116 DESTINATION
117 ${PACPUS_INSTALL_DIR}/bin
118 )
119 endif()
120endif()
121
122# ========================================
123# Doxygen
124# ========================================
125if(PACPUS_BUILD_DOC)
126 find_package(Doxygen)
127 if(NOT DOXYGEN_FOUND)
128 message(FATAL_ERROR "Doxygen is needed to build the documentation. Please install it correctly")
129 endif()
130endif()
Note: See TracBrowser for help on using the repository browser.