2019-10-02 10:47:26 +00:00
|
|
|
|
# Минимальная версия Cmake
|
|
|
|
|
cmake_minimum_required(VERSION 3.3)
|
|
|
|
|
cmake_policy(VERSION 3.0.2..3.7)
|
|
|
|
|
|
|
|
|
|
# Название проекта
|
2020-04-22 15:54:40 +00:00
|
|
|
|
project(myx VERSION 0.4.0 LANGUAGES C CXX)
|
2019-10-02 10:47:26 +00:00
|
|
|
|
|
2021-06-08 16:47:03 +00:00
|
|
|
|
# Обязательные переменные
|
|
|
|
|
set(CMLIB_ORGANIZATION_NAME "ECS5" CACHE STRING "")
|
|
|
|
|
set(CMLIB_AUTHOR_NAME "Андрей Астафьев" CACHE STRING "")
|
|
|
|
|
set(CMLIB_AUTHOR_EMAIL "dev@246060.ru" CACHE STRING "")
|
|
|
|
|
set(CMLIB_DESCRIPTION "Разные функции" CACHE STRING "")
|
|
|
|
|
|
2021-06-17 22:16:37 +00:00
|
|
|
|
# В каталоге cmake/cmlib находятся файлы с библиотечными функциями
|
|
|
|
|
if(NOT DEFINED CMLIB_MAIN_DIR)
|
|
|
|
|
set(CMLIB_MAIN_DIR "${CMAKE_SOURCE_DIR}/cmake/cmlib")
|
|
|
|
|
endif()
|
|
|
|
|
if(IS_DIRECTORY "${CMLIB_MAIN_DIR}" AND EXISTS "${CMLIB_MAIN_DIR}/CMLibCommon.cmake")
|
|
|
|
|
list(INSERT CMAKE_MODULE_PATH 0 "${CMLIB_MAIN_DIR}")
|
2019-10-02 10:47:26 +00:00
|
|
|
|
else()
|
2021-06-17 22:16:37 +00:00
|
|
|
|
message(FATAL_ERROR "CMLib main directory ${CMLIB_MAIN_DIR} does not exists")
|
2019-10-02 10:47:26 +00:00
|
|
|
|
endif()
|
|
|
|
|
|
2020-04-22 07:17:37 +00:00
|
|
|
|
if(NOT DEFINED MYXLIB_MASTER_PROJECT)
|
2020-04-22 15:54:40 +00:00
|
|
|
|
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
2020-04-22 07:17:37 +00:00
|
|
|
|
set(MYXLIB_MASTER_PROJECT ON)
|
|
|
|
|
else()
|
|
|
|
|
set(MYXLIB_MASTER_PROJECT OFF)
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
2019-10-02 10:47:26 +00:00
|
|
|
|
include(CMLibCommon)
|
|
|
|
|
|
2021-05-30 19:19:03 +00:00
|
|
|
|
#cmlib_set_cxx_standard(11)
|
2020-06-28 06:52:03 +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-22 15:54:40 +00:00
|
|
|
|
find_package(Qt5 COMPONENTS Core Network REQUIRED)
|
2019-10-02 10:47:26 +00:00
|
|
|
|
|
2021-06-01 11:24:25 +00:00
|
|
|
|
cmlib_generate_private_config_hpp()
|
|
|
|
|
|
2019-10-02 10:47:26 +00:00
|
|
|
|
# Библиотеки
|
2020-06-30 17:04:26 +00:00
|
|
|
|
add_subdirectory(src/myx/backports/compiler)
|
|
|
|
|
add_subdirectory(src/myx/backports/cpp)
|
|
|
|
|
add_subdirectory(src/myx/backports/qt)
|
|
|
|
|
add_subdirectory(src/myx/core)
|
2019-10-08 20:58:42 +00:00
|
|
|
|
add_subdirectory(src/myx/filesystem)
|
|
|
|
|
add_subdirectory(src/myx/qt)
|
2019-10-02 10:47:26 +00:00
|
|
|
|
|
2021-06-24 08:36:53 +00:00
|
|
|
|
# Цель, используемая только для установки заголовочных файлов без компиляции проекта
|
|
|
|
|
add_custom_target(myxlib-install-headers COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=base-dev -P
|
|
|
|
|
"${CMAKE_BINARY_DIR}/cmake_install.cmake")
|
2019-10-02 10:47:26 +00:00
|
|
|
|
# Примеры
|
2020-06-28 06:52:03 +00:00
|
|
|
|
if(MYXLIB_BUILD_EXAMPLES)
|
2020-06-30 17:04:26 +00:00
|
|
|
|
add_subdirectory(examples/core)
|
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-06-30 17:04:26 +00:00
|
|
|
|
add_custom_target(examples example-core-endian example-filesystem-paths example-qt-tranlators
|
2020-06-28 06:52:03 +00:00
|
|
|
|
example-qt-posix-signal-watcher)
|
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
|
|
|
|
# Документация
|
2021-06-17 21:59:05 +00:00
|
|
|
|
add_breathe_target(doc-breathe)
|
|
|
|
|
add_doxygen_target(doc-doxygen LATEX YES HTML YES)
|