2019-10-02 10:47:26 +00:00
|
|
|
|
# Минимальная версия 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)
|
|
|
|
|
|
2020-04-22 07:17:37 +00:00
|
|
|
|
if(NOT DEFINED MYXLIB_MASTER_PROJECT)
|
|
|
|
|
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
|
|
|
|
set(MYXLIB_MASTER_PROJECT ON)
|
|
|
|
|
else()
|
|
|
|
|
set(MYXLIB_MASTER_PROJECT OFF)
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
2019-10-02 10:47:26 +00:00
|
|
|
|
include(CMLibCommon)
|
|
|
|
|
|
2020-04-21 09:46:30 +00:00
|
|
|
|
option(MYXLIB_HEADER_ONLY "Build header only version of library" ON)
|
2020-04-21 07:25:35 +00:00
|
|
|
|
option(MYXLIB_BUILD_EXAMPLES "Build examples" OFF)
|
2019-10-04 06:39:20 +00:00
|
|
|
|
|
2019-10-02 10:47:26 +00:00
|
|
|
|
# Поиск библиотек с помощью pkgconfig
|
2020-04-21 07:25:35 +00:00
|
|
|
|
find_package(PkgConfig REQUIRED)
|
2019-10-02 10:47:26 +00:00
|
|
|
|
|
2020-04-03 21:04:02 +00:00
|
|
|
|
# Потоки
|
|
|
|
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
|
2019-10-02 10:47:26 +00:00
|
|
|
|
# Qt5
|
2020-04-11 07:13:25 +00:00
|
|
|
|
find_package(
|
|
|
|
|
Qt5
|
|
|
|
|
COMPONENTS
|
|
|
|
|
Core
|
|
|
|
|
Network
|
|
|
|
|
REQUIRED)
|
2019-10-02 10:47:26 +00:00
|
|
|
|
|
|
|
|
|
# Автоматически генерируемый заголовочный файл
|
2020-04-22 07:17:37 +00:00
|
|
|
|
# cmlib_config_hpp_generate()
|
2019-10-02 10:47:26 +00:00
|
|
|
|
|
2020-04-22 07:17:37 +00:00
|
|
|
|
# configure_file(${CMAKE_SOURCE_DIR}/src/myx/base/config_flags.hpp.in
|
|
|
|
|
# ${CMAKE_BINARY_DIR}/include/myx/base/config_flags.hpp)
|
2019-10-02 11:29:10 +00:00
|
|
|
|
|
2019-10-02 10:47:26 +00:00
|
|
|
|
# Подключение внешних проектов
|
|
|
|
|
include(ExternalProject)
|
|
|
|
|
|
|
|
|
|
# Библиотеки
|
2019-10-08 20:58:42 +00:00
|
|
|
|
add_subdirectory(src/myx/base)
|
|
|
|
|
add_subdirectory(src/myx/filesystem)
|
|
|
|
|
add_subdirectory(src/myx/qt)
|
2019-10-23 16:44:45 +00:00
|
|
|
|
add_subdirectory(src/myx/math)
|
2020-03-26 12:39:30 +00:00
|
|
|
|
add_subdirectory(src/myx/redis)
|
2019-10-02 10:47:26 +00:00
|
|
|
|
|
|
|
|
|
# Примеры
|
2020-04-11 07:13:25 +00:00
|
|
|
|
if(BUILD_EXAMPLES)
|
2019-10-04 06:39:20 +00:00
|
|
|
|
add_subdirectory(examples/filesystem)
|
2019-10-07 15:30:28 +00:00
|
|
|
|
add_subdirectory(examples/qt)
|
2020-04-11 07:13:25 +00:00
|
|
|
|
|
|
|
|
|
add_dependencies(example-filesystem-minimal create_auxilary_symlinks)
|
2019-10-04 06:39:20 +00:00
|
|
|
|
endif()
|
2019-10-02 10:47:26 +00:00
|
|
|
|
|
2019-10-19 03:50:55 +00:00
|
|
|
|
# Документация
|
2019-12-19 06:49:34 +00:00
|
|
|
|
add_subdirectory(cmake/doc)
|