forked from CloudCompare/CloudCompare
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeExternalLibs.cmake
74 lines (62 loc) · 2.82 KB
/
CMakeExternalLibs.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# ------------------------------------------------------------------------------
# Qt
# ------------------------------------------------------------------------------
## we will use cmake automoc feature
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set( QT5_ROOT_PATH CACHE PATH "Qt5 root directory (i.e. where the 'bin' folder lies)" )
if ( QT5_ROOT_PATH )
list( APPEND CMAKE_PREFIX_PATH ${QT5_ROOT_PATH} )
endif()
# find qt5 components
# find_package(Qt5 COMPONENTS OpenGL Widgets Core Gui PrintSupport Concurrent REQUIRED)
find_package(Qt5Widgets)
find_package(Qt5Core)
find_package(Qt5Gui)
find_package(Qt5PrintSupport)
find_package(Qt5Concurrent)
find_package(Qt5OpenGL)
find_package(Qt5OpenGLExtensions)
# in the case no Qt5Config.cmake file could be found, cmake will explicitly ask the user for the QT5_DIR containing it!
# thus no need to keep additional variables and checks
# Starting with the QtCore lib, find the bin and root directories
get_target_property(QT5_LIB_LOCATION Qt5::Core LOCATION_${CMAKE_BUILD_TYPE})
get_filename_component(QT_BINARY_DIR ${QT5_LIB_LOCATION} DIRECTORY)
# Apple uses frameworks - move up until we get to the base directory to set the bin directory properly
if ( APPLE )
get_filename_component(QT_BINARY_DIR ${QT_BINARY_DIR} DIRECTORY)
get_filename_component(QT_BINARY_DIR ${QT_BINARY_DIR} DIRECTORY)
set(QT_BINARY_DIR "${QT_BINARY_DIR}/bin")
set( MACDEPLOYQT "${QT_BINARY_DIR}/macdeployqt" )
endif()
# set QT5_ROOT_PATH if it wasn't set by the user
if ( NOT QT5_ROOT_PATH )
get_filename_component(QT5_ROOT_PATH ${QT_BINARY_DIR} DIRECTORY)
endif()
include_directories(${Qt5OpenGL_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
${Qt5Core_INCLUDE_DIRS}
${Qt5Gui_INCLUDE_DIRS}
${Qt5Concurrent_INCLUDE_DIRS}
${Qt5PrintSupport_INCLUDE_DIRS}
)
# turn on QStringBuilder for more efficient string construction
# see https://doc.qt.io/qt-5/qstring.html#more-efficient-string-construction
add_definitions( -DQT_USE_QSTRINGBUILDER )
# ------------------------------------------------------------------------------
# OpenGL
# ------------------------------------------------------------------------------
if ( MSVC )
# Where to find OpenGL libraries
set(WINDOWS_OPENGL_LIBS "C:\\Program Files (x86)\\Windows Kits\\8.0\\Lib\\win8\\um\\x64" CACHE PATH "WindowsSDK libraries" )
list( APPEND CMAKE_PREFIX_PATH ${WINDOWS_OPENGL_LIBS} )
endif()
# ------------------------------------------------------------------------------
# OpenMP
# ------------------------------------------------------------------------------
find_package(OpenMP QUIET)
if (OPENMP_FOUND)
message("OpenMP found")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()