myxlib/CMakeLists.txt

58 lines
1.6 KiB
CMake
Raw Normal View History

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
# В каталоге 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)
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)
2020-04-22 15:54:40 +00:00
option(MYXLIB_BUILD_LIBRARIES "Build libraries" OFF)
if(MYXLIB_BUILD_LIBRARIES)
option(MYXLIB_BUILD_EXAMPLES "Build examples" OFF)
endif()
option(MYXLIB_BUILD_EXAMPLES_HO "Build examples using header only version" OFF)
2019-10-02 10:47:26 +00:00
# Поиск библиотек с помощью pkgconfig
find_package(PkgConfig REQUIRED)
2019-10-02 10:47:26 +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
# Библиотеки
add_subdirectory(src/myx/base)
add_subdirectory(src/myx/filesystem)
add_subdirectory(src/myx/qt)
add_subdirectory(src/myx/math)
add_subdirectory(src/myx/redis)
2019-10-02 10:47:26 +00:00
# Примеры
2020-04-22 15:54:40 +00:00
if(MYXLIB_BUILD_EXAMPLES OR MYXLIB_BUILD_EXAMPLES_HO)
add_subdirectory(examples/filesystem)
add_subdirectory(examples/qt)
add_subdirectory(examples/redis)
endif()
2019-10-02 10:47:26 +00:00
# Документация
add_subdirectory(cmake/doc)