myx-example-qt-console/cmake/myx/MyxCMakeConfig.cmake

80 lines
3.4 KiB
CMake
Raw Normal View History

2022-10-04 12:03:27 +00:00
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # IN_LIST operator
2023-07-30 09:30:53 +00:00
# CMake выполняет проверку системного окружения с помощью модулей,
# расположенных в следующих каталогах:
# /usr/share/cmake-${CMAKE_VERSION}/Modules
# /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/cmake
# /usr/lib/cmake
# Если для используемой программы или библиотеки нет стандартного
# модуля для поиска, то можно использовать собственный.
# С помощью переменной `CMAKE_MODULE_PATH` указывается перечень
# дополнительных каталогов, в которых производится поиск модулей.
2022-10-07 12:02:23 +00:00
set(MYX_CMAKE_FIND_DIR "${PROJECT_SOURCE_DIR}/cmake/find")
if(IS_DIRECTORY "${MYX_CMAKE_FIND_DIR}")
if(NOT ${MYX_CMAKE_FIND_DIR} IN_LIST CMAKE_MODULE_PATH)
list(INSERT CMAKE_MODULE_PATH 0 "${MYX_CMAKE_FIND_DIR}")
endif()
endif()
2022-10-04 12:03:27 +00:00
get_filename_component(MYX_CMAKE_SOURCE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY)
set(MYX_CMAKE_BACKPORTS_DIR "${MYX_CMAKE_SOURCE_DIR}/backports")
set(MYX_CMAKE_LIB_DIR "${MYX_CMAKE_SOURCE_DIR}/lib")
2023-07-30 09:30:53 +00:00
# Модули для обеспечения обратной совместимости со старыми версиями CMake
2022-10-04 12:03:27 +00:00
include(${MYX_CMAKE_BACKPORTS_DIR}/IncludeGuard.cmake)
include(${MYX_CMAKE_BACKPORTS_DIR}/TopLevelProject.cmake)
if(${CMAKE_VERSION} VERSION_LESS "3.11.0")
include(${MYX_CMAKE_BACKPORTS_DIR}/FetchContent.cmake)
2022-10-06 12:23:22 +00:00
else()
include(FetchContent)
2022-10-04 12:03:27 +00:00
endif()
2023-07-30 09:30:53 +00:00
# Загрузка стандартных модулей
2022-10-06 12:23:22 +00:00
include(GNUInstallDirs)
include(CMakeDependentOption)
2023-07-30 09:30:53 +00:00
# Полезные макросы
2022-10-06 12:23:22 +00:00
include(${MYX_CMAKE_LIB_DIR}/macro/CreateSymlink.cmake)
include(${MYX_CMAKE_LIB_DIR}/macro/FindPackages.cmake)
include(${MYX_CMAKE_LIB_DIR}/macro/InstallRelative.cmake)
2022-10-07 12:02:23 +00:00
include(${MYX_CMAKE_LIB_DIR}/macro/CheckEnableCxxCompilerFlag.cmake)
2023-07-30 09:30:53 +00:00
include(${MYX_CMAKE_LIB_DIR}/macro/GTest.cmake)
include(${MYX_CMAKE_LIB_DIR}/macro/QTest.cmake)
2022-10-06 12:23:22 +00:00
2022-10-07 12:02:23 +00:00
include(${MYX_CMAKE_LIB_DIR}/ColoredMessages.cmake)
2022-10-06 12:23:22 +00:00
include(${MYX_CMAKE_LIB_DIR}/PopulateCMakeBinaryDir.cmake)
2022-10-04 12:03:27 +00:00
include(${MYX_CMAKE_LIB_DIR}/CurrentDate.cmake)
include(${MYX_CMAKE_LIB_DIR}/NinjaGeneratorWarning.cmake)
include(${MYX_CMAKE_LIB_DIR}/DirectoriesGuards.cmake)
include(${MYX_CMAKE_LIB_DIR}/SemanticProjectVersion.cmake)
include(${MYX_CMAKE_LIB_DIR}/NinjaGeneratorWrapper.cmake)
2023-07-30 09:30:53 +00:00
include(${MYX_CMAKE_LIB_DIR}/AddExternalTarget.cmake)
2022-10-04 12:03:27 +00:00
include(${MYX_CMAKE_LIB_DIR}/FetchContentAdd.cmake)
2023-07-30 09:30:53 +00:00
set(MYX_CMAKE_TOOLCHAINS_DIR "${MYX_CMAKE_LIB_DIR}/toolchains")
include(${MYX_CMAKE_LIB_DIR}/Toolchains.cmake)
unset(MYX_CMAKE_TOOLCHAINS_DIR)
2022-10-06 12:23:22 +00:00
include(${MYX_CMAKE_LIB_DIR}/AddExecutable.cmake)
2022-10-20 09:54:02 +00:00
include(${MYX_CMAKE_LIB_DIR}/AddInterfaceLibrary.cmake)
include(${MYX_CMAKE_LIB_DIR}/AddObjectLibrary.cmake)
2022-10-04 12:03:27 +00:00
include(${MYX_CMAKE_LIB_DIR}/TargetSetup.cmake)
include(${MYX_CMAKE_LIB_DIR}/Qt5TargetSetup.cmake)
2022-10-06 12:23:22 +00:00
include(${MYX_CMAKE_LIB_DIR}/uncrustify/Uncrustify.cmake)
include(${MYX_CMAKE_LIB_DIR}/doc/Doxygen.cmake)
2022-10-04 12:03:27 +00:00
include(${MYX_CMAKE_LIB_DIR}/generators/PrivateConfigHeader.cmake)
2022-10-06 12:23:22 +00:00
include(${MYX_CMAKE_LIB_DIR}/generators/GitInfoHeader.cmake)
2022-10-04 12:03:27 +00:00
2022-10-09 02:58:20 +00:00
include(${MYX_CMAKE_LIB_DIR}/CreatePackages.cmake)
2022-10-07 12:02:23 +00:00
include(${MYX_CMAKE_LIB_DIR}/Uninstall.cmake)
2022-10-04 12:03:27 +00:00
unset(MYX_CMAKE_SOURCE_DIR)
unset(MYX_CMAKE_BACKPORTS_DIR)
unset(MYX_CMAKE_LIB_DIR)
cmake_policy(POP)