2020-04-11 11:06:19 +00:00
|
|
|
|
# Минимальная версия CMake
|
2021-07-02 07:49:24 +00:00
|
|
|
|
cmake_minimum_required(VERSION 3.6)
|
2020-04-11 11:06:19 +00:00
|
|
|
|
|
|
|
|
|
# Предпочтительно следовать стандартам принятым в указанном диапазоне версий
|
|
|
|
|
cmake_policy(VERSION 3.0.2..3.7)
|
|
|
|
|
|
|
|
|
|
# Название и версия проекта и используемые языки программирования
|
2020-04-13 21:36:09 +00:00
|
|
|
|
project(cmlib-example-app-qt5-con VERSION 0.2.0 LANGUAGES C CXX)
|
2020-04-11 11:06:19 +00:00
|
|
|
|
|
2021-07-02 07:49:24 +00:00
|
|
|
|
# Обязательные переменные
|
|
|
|
|
set(CMLIB_ORGANIZATION_NAME "ECS5" CACHE STRING "")
|
|
|
|
|
set(CMLIB_AUTHOR_NAME "Андрей Астафьев" CACHE STRING "")
|
|
|
|
|
set(CMLIB_AUTHOR_EMAIL "dev@246060.ru" CACHE STRING "")
|
2021-07-02 07:57:21 +00:00
|
|
|
|
set(CMLIB_DESCRIPTION "Пример проекта: консольное приложение Qt5" CACHE STRING "")
|
2021-07-02 07:49:24 +00:00
|
|
|
|
|
2020-04-11 11:06:19 +00:00
|
|
|
|
# В каталоге cmake/cmlib находятся файлы с библиотечными функциями
|
2021-07-02 07:49:24 +00:00
|
|
|
|
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}")
|
2020-04-11 11:06:19 +00:00
|
|
|
|
else()
|
2021-07-02 07:49:24 +00:00
|
|
|
|
message(FATAL_ERROR "CMLib main directory ${CMLIB_MAIN_DIR} does not exists")
|
2020-04-11 11:06:19 +00:00
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
include(CMLibCommon)
|
|
|
|
|
|
2020-04-11 11:42:41 +00:00
|
|
|
|
# Boost
|
|
|
|
|
set(Boost_USE_STATIC_LIBS ON)
|
|
|
|
|
set(Boost_USE_MULTITHREADED OFF)
|
|
|
|
|
set(Boost_USE_STATIC_RUNTIME ON)
|
2020-04-22 18:20:11 +00:00
|
|
|
|
find_package(Boost 1.55.0 REQUIRED)
|
2020-04-11 11:42:41 +00:00
|
|
|
|
|
2020-04-13 21:36:09 +00:00
|
|
|
|
# Qt5
|
|
|
|
|
find_package(Qt5 COMPONENTS Core REQUIRED)
|
|
|
|
|
|
2020-04-11 11:42:41 +00:00
|
|
|
|
# Автоматически генерируемый заголовочный файл
|
2021-07-02 07:49:24 +00:00
|
|
|
|
cmlib_generate_private_config_hpp()
|
2020-04-11 11:42:41 +00:00
|
|
|
|
|
2020-04-13 21:36:09 +00:00
|
|
|
|
# Подключение внешних проектов
|
|
|
|
|
include(ExternalProject)
|
|
|
|
|
|
|
|
|
|
ExternalProject_Add(
|
|
|
|
|
myxlib
|
|
|
|
|
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/myxlib
|
|
|
|
|
INSTALL_DIR ${CMAKE_BINARY_DIR}
|
|
|
|
|
DOWNLOAD_COMMAND ""
|
2021-07-02 07:57:21 +00:00
|
|
|
|
CONFIGURE_COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" ${CMLIB_EXT_PROJ_DEFAULT_ARGS} <SOURCE_DIR>
|
2020-04-13 21:36:09 +00:00
|
|
|
|
BUILD_COMMAND true)
|
|
|
|
|
|
2020-04-11 11:42:41 +00:00
|
|
|
|
# Приложение
|
|
|
|
|
add_subdirectory(src/cmlib-example)
|
|
|
|
|
|
|
|
|
|
# Документация
|
2021-07-02 07:49:24 +00:00
|
|
|
|
add_breathe_target(doc-breathe)
|
|
|
|
|
add_doxygen_target(doc-doxygen LATEX YES HTML YES)
|
2020-04-11 11:42:41 +00:00
|
|
|
|
|
|
|
|
|
# Создание вспомогательных символических ссылок
|
2020-04-13 22:05:13 +00:00
|
|
|
|
add_dependencies(cmlib-example-app-qt5-con create_auxilary_symlinks)
|
2020-04-11 11:42:41 +00:00
|
|
|
|
|