myxlib/CMakeLists.txt

55 lines
1.5 KiB
CMake
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Минимальная версия Cmake
cmake_minimum_required(VERSION 3.3)
cmake_policy(VERSION 3.0.2..3.7)
# Название проекта
project(myx VERSION 0.4.0 LANGUAGES C CXX)
# В каталоге 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)
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)
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)
# Поиск библиотек с помощью pkgconfig
find_package(PkgConfig REQUIRED)
# Потоки
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
# Qt5
find_package(Qt5 COMPONENTS Core Network REQUIRED)
# Библиотеки
add_subdirectory(src/myx/base)
add_subdirectory(src/myx/filesystem)
add_subdirectory(src/myx/qt)
# Примеры
if(MYXLIB_BUILD_EXAMPLES OR MYXLIB_BUILD_EXAMPLES_HO)
add_subdirectory(examples/filesystem)
add_subdirectory(examples/qt)
endif()
# Документация
add_subdirectory(cmake/doc)