From 96cdd184fa9737ac4b43db5c01054b47a8f6d63a Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Mon, 24 Oct 2022 20:03:42 +0300 Subject: [PATCH] 2.1.93 --- MyxCMake/MyxCMakeConfig.cmake | 13 +++++++++++- MyxCMake/MyxCMakeConfigVersion.cmake | 2 +- .../macro/CheckEnableCxxCompilerFlag.cmake | 21 ++++++++++--------- MyxCMake/lib/macro/CreateSymlink.cmake | 12 ++++++----- MyxCMake/lib/macro/FindPackages.cmake | 4 ++-- README.md | 2 +- VERSION | 2 +- debian/CMakeLists.txt | 2 +- debian/changelog | 2 +- myx_setup.cmake | 4 ++-- 10 files changed, 39 insertions(+), 25 deletions(-) diff --git a/MyxCMake/MyxCMakeConfig.cmake b/MyxCMake/MyxCMakeConfig.cmake index cf8aee9..464d514 100644 --- a/MyxCMake/MyxCMakeConfig.cmake +++ b/MyxCMake/MyxCMakeConfig.cmake @@ -1,7 +1,15 @@ cmake_policy(PUSH) cmake_policy(SET CMP0057 NEW) # IN_LIST operator -# Каталог для модулей, выполняющих поиск библиотек +# CMake выполняет проверку системного окружения с помощью модулей, +# расположенных в следующих каталогах: +# /usr/share/cmake-${CMAKE_VERSION}/Modules +# /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/cmake +# /usr/lib/cmake +# Если для используемой программы или библиотеки нет стандартного +# модуля для поиска, то можно использовать собственный. +# С помощью переменной `CMAKE_MODULE_PATH` указывается перечень +# дополнительных каталогов, в которых производится поиск модулей. 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) @@ -14,6 +22,7 @@ get_filename_component(MYX_CMAKE_SOURCE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTO set(MYX_CMAKE_BACKPORTS_DIR "${MYX_CMAKE_SOURCE_DIR}/backports") set(MYX_CMAKE_LIB_DIR "${MYX_CMAKE_SOURCE_DIR}/lib") +# Модули для обеспечения обратной совместимости со старыми версиями CMake include(${MYX_CMAKE_BACKPORTS_DIR}/IncludeGuard.cmake) include(${MYX_CMAKE_BACKPORTS_DIR}/TopLevelProject.cmake) if(${CMAKE_VERSION} VERSION_LESS "3.11.0") @@ -22,9 +31,11 @@ else() include(FetchContent) endif() +# Загрузка стандартных модулей include(GNUInstallDirs) include(CMakeDependentOption) +# Полезные макросы include(${MYX_CMAKE_LIB_DIR}/macro/CreateSymlink.cmake) include(${MYX_CMAKE_LIB_DIR}/macro/FindPackages.cmake) include(${MYX_CMAKE_LIB_DIR}/macro/InstallRelative.cmake) diff --git a/MyxCMake/MyxCMakeConfigVersion.cmake b/MyxCMake/MyxCMakeConfigVersion.cmake index af6e5d3..e6d7ed3 100644 --- a/MyxCMake/MyxCMakeConfigVersion.cmake +++ b/MyxCMake/MyxCMakeConfigVersion.cmake @@ -1,4 +1,4 @@ -set(MYX_CMAKE_PACKAGE_VERSION "2.1.92") +set(MYX_CMAKE_PACKAGE_VERSION "2.1.93") if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) set(PACKAGE_VERSION_COMPATIBLE FALSE) else() diff --git a/MyxCMake/lib/macro/CheckEnableCxxCompilerFlag.cmake b/MyxCMake/lib/macro/CheckEnableCxxCompilerFlag.cmake index c711262..eb24c11 100644 --- a/MyxCMake/lib/macro/CheckEnableCxxCompilerFlag.cmake +++ b/MyxCMake/lib/macro/CheckEnableCxxCompilerFlag.cmake @@ -1,33 +1,34 @@ include_guard(GLOBAL) -# based on https://github.com/bluescarni/yacma - +# Добавление флага к списку используемых после проверки +# возможности его использования текущим компилятором +# Основано на https://github.com/bluescarni/yacma include(CheckCXXCompilerFlag) -macro(check_enable_cxx_compiler_flag flag) +macro(check_enable_cxx_compiler_flag FLAG) set(options) set(oneValueArgs TARGET) set(multiValueArgs) cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) set(CMAKE_REQUIRED_QUIET TRUE) - check_cxx_compiler_flag("${flag}" check_cxx_flag) + check_cxx_compiler_flag("${FLAG}" check_cxx_flag) unset(CMAKE_REQUIRED_QUIET) if(check_cxx_flag) - myx_message_notice("'${flag}': flag is supported.") + myx_message_notice("'${FLAG}': flag is supported.") if(ARG_TARGET) - target_compile_options(${ARG_TARGET} PUBLIC ${flag}) + target_compile_options(${ARG_TARGET} PUBLIC ${FLAG}) else() - add_compile_options(${flag}) + add_compile_options(${FLAG}) endif() else() - myx_message_status("'${flag}': flag is NOT supported.") + myx_message_status("'${FLAG}': flag is NOT supported.") endif() unset(check_cxx_flag CACHE) - foreach(iter IN LISTS oneValueArgs multiValueArgs) - unset(ARG_${iter}) + foreach(__iter IN LISTS oneValueArgs multiValueArgs) + unset(ARG_${__iter}) endforeach() unset(ARG_UNPARSED_ARGUMENTS) unset(multiValueArgs) diff --git a/MyxCMake/lib/macro/CreateSymlink.cmake b/MyxCMake/lib/macro/CreateSymlink.cmake index 9a3bcd5..15b7e44 100644 --- a/MyxCMake/lib/macro/CreateSymlink.cmake +++ b/MyxCMake/lib/macro/CreateSymlink.cmake @@ -1,11 +1,13 @@ include_guard(GLOBAL) -macro(myx_create_symlink original linkname) - if(UNIX AND (NOT EXISTS ${linkname})) +# Создание символических ссылок +macro(myx_create_symlink ORIGINAL_FILENAME LINKNAME) + if(UNIX AND (NOT EXISTS ${LINKNAME})) if(${CMAKE_VERSION} VERSION_LESS "3.14.0") - execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${original} ${linkname}) + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink + ${ORIGINAL_FILENAME} ${LINKNAME}) else() - file(CREATE_LINK ${original} ${linkname} SYMBOLIC) + file(CREATE_LINK ${ORIGINAL_FILENAME} ${LINKNAME} SYMBOLIC) endif() endif() -endmacro(myx_create_symlink original linkname) +endmacro(myx_create_symlink ORIGINAL_FILENAME LINKNAME) diff --git a/MyxCMake/lib/macro/FindPackages.cmake b/MyxCMake/lib/macro/FindPackages.cmake index 63da746..ff57ccc 100644 --- a/MyxCMake/lib/macro/FindPackages.cmake +++ b/MyxCMake/lib/macro/FindPackages.cmake @@ -24,8 +24,8 @@ macro(myx_find_required_packages) endforeach() endif() - foreach(iter IN LISTS oneValueArgs multiValueArgs) - unset(ARG_${iter}) + foreach(__iter IN LISTS oneValueArgs multiValueArgs) + unset(ARG_${__iter}) endforeach() unset(ARG_UNPARSED_ARGUMENTS) unset(multiValueArgs) diff --git a/README.md b/README.md index d0544c6..7bffc6d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Установка В корневом каталоге проекта создать каталог `cmake` и распаковать в него -[архив](../../../releases/download/2.1.92/myx-cmake-local-2.1.92.tar.xz ). +[архив](../../../releases/download/2.1.93/myx-cmake-local-2.1.93.tar.xz ). ## Использование diff --git a/VERSION b/VERSION index a048613..9be10bc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.1.92 +2.1.93 diff --git a/debian/CMakeLists.txt b/debian/CMakeLists.txt index 9246497..ebcbe11 100644 --- a/debian/CMakeLists.txt +++ b/debian/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.6 FATAL_ERROR) -project(myx-cmake VERSION 2.1.92 LANGUAGES) +project(myx-cmake VERSION 2.1.93 LANGUAGES) include(GNUInstallDirs) file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake diff --git a/debian/changelog b/debian/changelog index b71dd77..112a3ac 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -myx-cmake (2.1.92) unstable; urgency=medium +myx-cmake (2.1.93) unstable; urgency=medium * New version. diff --git a/myx_setup.cmake b/myx_setup.cmake index 33013a9..e8bb699 100644 --- a/myx_setup.cmake +++ b/myx_setup.cmake @@ -20,11 +20,11 @@ if(ENV{MYX_CMAKE_DIR}) set(MYX_CMAKE_DIR $ENV{MYX_CMAKE_DIR}) endif() if(MYX_CMAKE_DIR) - find_package(MyxCMake 2.1.92 REQUIRED CONFIG PATHS ${MYX_CMAKE_DIR} NO_DEFAULT_PATH) + find_package(MyxCMake 2.1.93 REQUIRED CONFIG PATHS ${MYX_CMAKE_DIR} NO_DEFAULT_PATH) myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===") else() if(MYX_CMAKE_USE_SYSTEM) - find_package(MyxCMake 2.1.92 REQUIRED) + find_package(MyxCMake 2.1.93 REQUIRED) myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===") else() include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)