2020-04-11 11:06:19 +00:00
|
|
|
|
# Минимальная версия CMake
|
|
|
|
|
cmake_minimum_required(VERSION 3.3)
|
|
|
|
|
|
|
|
|
|
# Предпочтительно следовать стандартам принятым в указанном диапазоне версий
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
# В каталоге cmake/cmlib находятся файлы с библиотечными функциями
|
|
|
|
|
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 does not exist")
|
|
|
|
|
endif()
|
|
|
|
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/find)
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
find_package(Boost 1.55.0 REQUIRED COMPONENTS headers)
|
|
|
|
|
|
2020-04-13 21:36:09 +00:00
|
|
|
|
# Qt5
|
|
|
|
|
find_package(Qt5 COMPONENTS Core REQUIRED)
|
|
|
|
|
|
2020-04-11 11:42:41 +00:00
|
|
|
|
# Автоматически генерируемый заголовочный файл
|
|
|
|
|
cmlib_config_hpp_generate()
|
|
|
|
|
|
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 ""
|
|
|
|
|
CONFIGURE_COMMAND
|
|
|
|
|
${CMAKE_COMMAND} -"G${CMAKE_GENERATOR}" -DCMAKE_BUILD_TYPE=Debug
|
|
|
|
|
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
|
|
|
|
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
|
|
|
|
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} <SOURCE_DIR>
|
|
|
|
|
BUILD_COMMAND true)
|
|
|
|
|
|
2020-04-11 11:42:41 +00:00
|
|
|
|
# Приложение
|
|
|
|
|
add_subdirectory(src/cmlib-example)
|
|
|
|
|
|
|
|
|
|
# Документация
|
|
|
|
|
add_subdirectory(cmake/doc)
|
|
|
|
|
|
|
|
|
|
# Создание вспомогательных символических ссылок
|
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
|
|
|
|
|