-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathCMakeLists.txt
30 lines (23 loc) · 1.15 KB
/
CMakeLists.txt
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
# Created by Marcel Paz Goldschen-Ohm <[email protected]>
# !!! Set env variable QT5_DIR to <Qt install prefix>/lib/cmake/Qt5
# For macx xcode project: cmake -G Xcode <dir of CMakeLists.txt>
cmake_minimum_required(VERSION 3.11)
set(PROJECT_NAME QtPropertySerializer)
project(${PROJECT_NAME} LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11) # This is equal to QMAKE_CXX_FLAGS += -std=c++0x
set(CMAKE_INCLUDE_CURRENT_DIR ON) # Search in current dir.
set(CMAKE_AUTOMOC ON) # Run moc automatically for Qt.
set(CMAKE_AUTOUIC ON) # Run uic automatically for *.ui files.
set(CMAKE_AUTORCC ON) # Run automatically for *.qrc files.
if(APPLE AND EXISTS /usr/local/opt/qt5)
# Homebrew installs Qt5 (up to at least 5.9.1) in
# /usr/local/qt5, ensure it can be found by CMake since
# it is not in the default /usr/local prefix.
list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/qt5")
endif()
# Find required packages.
find_package(Qt5 COMPONENTS Core REQUIRED)
# Build project as a static library.
add_library(${PROJECT_NAME} STATIC QtPropertySerializer.cpp QtPropertySerializer.h)
qt5_use_modules(${PROJECT_NAME} Core)
target_link_libraries(${PROJECT_NAME} ${QT_LIBRARIES})