67 lines
1.6 KiB
CMake
67 lines
1.6 KiB
CMake
# Минимальная версия Cmake
|
||
cmake_minimum_required(VERSION 3.3)
|
||
cmake_policy(VERSION 3.0.2..3.7)
|
||
|
||
# Название проекта
|
||
project(myx VERSION 0.3.0 LANGUAGES C CXX)
|
||
|
||
# В каталоге cmake/lib находятся файлы с библиотечными функциями
|
||
if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/cmake/cmlib)
|
||
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/cmlib)
|
||
else()
|
||
message(FATAL_ERROR "CMake library directory not exists")
|
||
endif()
|
||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/find)
|
||
|
||
include(CMLibCommon)
|
||
|
||
option(BUILD_EXAMPLES "Build examples" OFF)
|
||
|
||
# Поиск библиотек с помощью pkgconfig
|
||
find_package(PkgConfig)
|
||
|
||
# Потоки
|
||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||
find_package(Threads REQUIRED)
|
||
|
||
# Qt5
|
||
find_package(
|
||
Qt5
|
||
COMPONENTS
|
||
Core
|
||
Network
|
||
Gui
|
||
Widgets
|
||
DBus
|
||
Concurrent
|
||
Sql
|
||
REQUIRED)
|
||
|
||
# Автоматически генерируемый заголовочный файл
|
||
cmlib_config_hpp_generate()
|
||
|
||
configure_file(${CMAKE_SOURCE_DIR}/src/myx/base/config_flags.hpp.in
|
||
${CMAKE_BINARY_DIR}/include/config_flags.hpp)
|
||
|
||
# Подключение внешних проектов
|
||
include(ExternalProject)
|
||
|
||
# Библиотеки
|
||
add_subdirectory(src/myx/base)
|
||
add_subdirectory(src/myx/filesystem)
|
||
add_subdirectory(src/myx/qt)
|
||
add_subdirectory(src/myx/math)
|
||
add_subdirectory(src/myx/redis)
|
||
|
||
# Примеры
|
||
if(BUILD_EXAMPLES)
|
||
add_subdirectory(examples/filesystem)
|
||
add_subdirectory(examples/qt)
|
||
|
||
add_dependencies(example-filesystem-minimal create_auxilary_symlinks)
|
||
endif()
|
||
|
||
# Документация
|
||
add_subdirectory(cmake/doc)
|
||
|