72 lines
2.5 KiB
CMake
72 lines
2.5 KiB
CMake
# Минимальная версия Cmake
|
||
cmake_minimum_required(VERSION 3.3)
|
||
cmake_policy(VERSION 3.0.2..3.7)
|
||
|
||
# Название проекта
|
||
project(myx VERSION 0.4.0 LANGUAGES C CXX)
|
||
|
||
# Обязательные переменные
|
||
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 "")
|
||
|
||
# В каталоге 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}")
|
||
else()
|
||
message(FATAL_ERROR "CMLib main directory ${CMLIB_MAIN_DIR} does not exists")
|
||
endif()
|
||
|
||
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()
|
||
|
||
include(CMLibCommon)
|
||
|
||
#cmlib_set_cxx_standard(11)
|
||
option(MYXLIB_BUILD_EXAMPLES "Build examples" OFF)
|
||
|
||
# Поиск библиотек с помощью pkgconfig
|
||
find_package(PkgConfig REQUIRED)
|
||
|
||
# Потоки
|
||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||
find_package(Threads REQUIRED)
|
||
|
||
# Qt5
|
||
find_package(Qt5 COMPONENTS Core Network REQUIRED)
|
||
|
||
cmlib_generate_private_config_hpp()
|
||
|
||
# Библиотеки
|
||
add_subdirectory(src/myx/backports/compiler)
|
||
add_subdirectory(src/myx/backports/cpp)
|
||
add_subdirectory(src/myx/backports/qt)
|
||
add_subdirectory(src/myx/core)
|
||
add_subdirectory(src/myx/filesystem)
|
||
add_subdirectory(src/myx/qt)
|
||
|
||
# Цель, используемая только для установки заголовочных файлов без компиляции проекта
|
||
add_custom_target(myxlib-install-headers COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=base-dev -P
|
||
"${CMAKE_BINARY_DIR}/cmake_install.cmake")
|
||
# Примеры
|
||
if(MYXLIB_BUILD_EXAMPLES)
|
||
add_subdirectory(examples/core)
|
||
add_subdirectory(examples/filesystem)
|
||
add_subdirectory(examples/qt)
|
||
add_custom_target(examples example-core-endian example-filesystem-paths example-qt-tranlators
|
||
example-qt-posix-signal-watcher)
|
||
endif()
|
||
|
||
# Документация
|
||
add_breathe_target(doc-breathe)
|
||
add_doxygen_target(doc-doxygen LATEX YES HTML YES)
|