From b0dc31b1d5961994552f6862c466bfb552a70dcd Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Sun, 23 Oct 2022 19:38:59 +0300 Subject: [PATCH] 2.1.92 --- MyxCMake/MyxCMakeConfig.cmake | 7 ++-- MyxCMake/MyxCMakeConfigVersion.cmake | 2 +- MyxCMake/backports/IncludeGuard.cmake | 2 +- MyxCMake/backports/TopLevelProject.cmake | 7 ++-- MyxCMake/lib/CompilerFlags.cmake | 28 --------------- MyxCMake/lib/NinjaGeneratorWarning.cmake | 2 +- MyxCMake/lib/Toolchain.cmake | 35 ------------------- .../lib/{LSBInfo.cmake => Toolchains.cmake} | 22 ++++++++++++ .../lib/toolchains/AstraLinuxSE-1.5.cmake | 8 +++++ MyxCMake/lib/toolchains/Clang.cmake | 3 ++ MyxCMake/lib/toolchains/ElbrusD-1.4.cmake | 9 +++++ MyxCMake/lib/toolchains/GCC.cmake | 3 ++ README.md | 2 +- VERSION | 2 +- debian/CMakeLists.txt | 2 +- debian/changelog | 2 +- myx_setup.cmake | 4 +-- 17 files changed, 61 insertions(+), 79 deletions(-) delete mode 100644 MyxCMake/lib/CompilerFlags.cmake delete mode 100644 MyxCMake/lib/Toolchain.cmake rename MyxCMake/lib/{LSBInfo.cmake => Toolchains.cmake} (61%) create mode 100644 MyxCMake/lib/toolchains/AstraLinuxSE-1.5.cmake create mode 100644 MyxCMake/lib/toolchains/Clang.cmake create mode 100644 MyxCMake/lib/toolchains/ElbrusD-1.4.cmake create mode 100644 MyxCMake/lib/toolchains/GCC.cmake diff --git a/MyxCMake/MyxCMakeConfig.cmake b/MyxCMake/MyxCMakeConfig.cmake index 09bf810..cf8aee9 100644 --- a/MyxCMake/MyxCMakeConfig.cmake +++ b/MyxCMake/MyxCMakeConfig.cmake @@ -39,9 +39,10 @@ include(${MYX_CMAKE_LIB_DIR}/SemanticProjectVersion.cmake) include(${MYX_CMAKE_LIB_DIR}/NinjaGeneratorWrapper.cmake) include(${MYX_CMAKE_LIB_DIR}/FetchContentAdd.cmake) -include(${MYX_CMAKE_LIB_DIR}/LSBInfo.cmake) -include(${MYX_CMAKE_LIB_DIR}/Toolchain.cmake) -include(${MYX_CMAKE_LIB_DIR}/CompilerFlags.cmake) +set(MYX_CMAKE_TOOLCHAINS_DIR "${MYX_CMAKE_LIB_DIR}/toolchains") +include(${MYX_CMAKE_LIB_DIR}/Toolchains.cmake) +unset(MYX_CMAKE_TOOLCHAINS_DIR) + include(${MYX_CMAKE_LIB_DIR}/AddExecutable.cmake) include(${MYX_CMAKE_LIB_DIR}/AddInterfaceLibrary.cmake) include(${MYX_CMAKE_LIB_DIR}/AddObjectLibrary.cmake) diff --git a/MyxCMake/MyxCMakeConfigVersion.cmake b/MyxCMake/MyxCMakeConfigVersion.cmake index 7e386cb..af6e5d3 100644 --- a/MyxCMake/MyxCMakeConfigVersion.cmake +++ b/MyxCMake/MyxCMakeConfigVersion.cmake @@ -1,4 +1,4 @@ -set(MYX_CMAKE_PACKAGE_VERSION "2.0.33") +set(MYX_CMAKE_PACKAGE_VERSION "2.1.92") if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) set(PACKAGE_VERSION_COMPATIBLE FALSE) else() diff --git a/MyxCMake/backports/IncludeGuard.cmake b/MyxCMake/backports/IncludeGuard.cmake index 1e577c3..827683c 100644 --- a/MyxCMake/backports/IncludeGuard.cmake +++ b/MyxCMake/backports/IncludeGuard.cmake @@ -3,7 +3,7 @@ # Макрос реализован для обратной совместимости if(${CMAKE_VERSION} VERSION_LESS "3.10.0") macro(include_guard) - if (CMAKE_FILE_${CMAKE_CURRENT_LIST_FILE}_ALREADY_INCLUDED) + if(CMAKE_FILE_${CMAKE_CURRENT_LIST_FILE}_ALREADY_INCLUDED) return() endif() set(CMAKE_FILE_${CMAKE_CURRENT_LIST_FILE}_ALREADY_INCLUDED TRUE) diff --git a/MyxCMake/backports/TopLevelProject.cmake b/MyxCMake/backports/TopLevelProject.cmake index 86994cc..7dbccec 100644 --- a/MyxCMake/backports/TopLevelProject.cmake +++ b/MyxCMake/backports/TopLevelProject.cmake @@ -1,10 +1,9 @@ include_guard(GLOBAL) if(${CMAKE_VERSION} VERSION_LESS 3.21) - get_property(nt DIRECTORY PROPERTY PARENT_DIRECTORY) - if(NOT nt) + get_property(__parent_directory DIRECTORY PROPERTY PARENT_DIRECTORY) + if(NOT __parent_directory) set(PROJECT_IS_TOP_LEVEL true) endif() - unset(nt) + unset(__parent_directory) endif() - diff --git a/MyxCMake/lib/CompilerFlags.cmake b/MyxCMake/lib/CompilerFlags.cmake deleted file mode 100644 index 7108dbc..0000000 --- a/MyxCMake/lib/CompilerFlags.cmake +++ /dev/null @@ -1,28 +0,0 @@ -include_guard(GLOBAL) - -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") -# cmake-format: off - if((MYX_CMAKE_LSB_DISTRIBUTOR_ID STREQUAL "AstraLinuxSE") AND - (MYX_CMAKE_LSB_CODENAME STREQUAL "smolensk") AND - (MYX_CMAKE_LSB_RELEASE_VERSION STREQUAL "1.5")) -# cmake-format: on - set(CMAKE_CXX_STANDARD 11) - set(CMAKE_CXX_EXTENSIONS ON) - check_enable_cxx_compiler_flag(-Wno-shadow) - elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "e2k") - set(CMAKE_CXX_STANDARD 14) - set(CMAKE_CXX_EXTENSIONS ON) - check_enable_cxx_compiler_flag(-Wno-invalid-offsetof) - list(APPEND CMAKE_LIBRARY_PATH "/usr/lib/e2k-linux-gnu") - endif() - if(CMAKE_COLOR_MAKEFILE) - check_enable_cxx_compiler_flag(-fdiagnostics-color=auto) - endif() -endif() - -if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - if(CMAKE_COLOR_MAKEFILE) - check_enable_cxx_compiler_flag(-fcolor-diagnostics) - endif() -endif() - diff --git a/MyxCMake/lib/NinjaGeneratorWarning.cmake b/MyxCMake/lib/NinjaGeneratorWarning.cmake index b9118d7..a07ee69 100644 --- a/MyxCMake/lib/NinjaGeneratorWarning.cmake +++ b/MyxCMake/lib/NinjaGeneratorWarning.cmake @@ -4,5 +4,5 @@ include_guard(GLOBAL) if(${CMAKE_VERSION} VERSION_LESS "3.8.0" AND CMAKE_GENERATOR MATCHES Ninja) - myx_message_error("Myx: Old CMake versions should use Makefile generator") + myx_message_send_error("Myx: Old CMake versions should use Makefile generator") endif() diff --git a/MyxCMake/lib/Toolchain.cmake b/MyxCMake/lib/Toolchain.cmake deleted file mode 100644 index 817a113..0000000 --- a/MyxCMake/lib/Toolchain.cmake +++ /dev/null @@ -1,35 +0,0 @@ -include_guard(GLOBAL) - -# Предпочтительные пути к утилитам для компоновки -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") -# cmake-format: off - # Astra Linux Smolensk 1.5 - if((MYX_CMAKE_LSB_DISTRIBUTOR_ID STREQUAL "AstraLinuxSE") AND - (MYX_CMAKE_LSB_CODENAME STREQUAL "smolensk") AND - (MYX_CMAKE_LSB_RELEASE_VERSION STREQUAL "1.5")) - find_program(CMAKE_GCC_AR NAMES "/usr/bin/x86_64-linux-gnu-gcc-ar-4.7") - find_program(CMAKE_GCC_NM NAMES "/usr/bin/x86_64-linux-gnu-gcc-nm-4.7") - find_program(CMAKE_GCC_RANLIB NAMES "/usr/bin/x86_64-linux-gnu-gcc-ranlib-4.7") - # Elbrus E2K - elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "e2k") - find_program(CMAKE_GCC_AR NAMES "/usr/${CMAKE_SYSTEM_PROCESSOR}-linux/bin/ar") - find_program(CMAKE_GCC_NM NAMES "/usr/${CMAKE_SYSTEM_PROCESSOR}-linux/bin/nm") - find_program(CMAKE_GCC_RANLIB NAMES "/usr/${CMAKE_SYSTEM_PROCESSOR}-linux/bin/ranlib") - # Другие версии Linux - else() - find_program(CMAKE_GCC_AR NAMES "gcc-ar" "ar") - find_program(CMAKE_GCC_NM NAMES "gcc-nm" "nm") - find_program(CMAKE_GCC_RANLIB NAMES "gcc-ranlib" "ranlib") - endif() -# cmake-format: on - - if(CMAKE_GCC_AR) - set(CMAKE_AR ${CMAKE_GCC_AR} CACHE STRING "" FORCE) - endif() - if(CMAKE_GCC_NM) - set(CMAKE_NM ${CMAKE_GCC_NM} CACHE STRING "" FORCE) - endif() - if(CMAKE_GCC_RANLIB) - set(CMAKE_RANLIB ${CMAKE_GCC_RANLIB} CACHE STRING "" FORCE) - endif() -endif() diff --git a/MyxCMake/lib/LSBInfo.cmake b/MyxCMake/lib/Toolchains.cmake similarity index 61% rename from MyxCMake/lib/LSBInfo.cmake rename to MyxCMake/lib/Toolchains.cmake index 0f15d86..963098d 100644 --- a/MyxCMake/lib/LSBInfo.cmake +++ b/MyxCMake/lib/Toolchains.cmake @@ -32,3 +32,25 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux) # cmake-format: on endif() endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + include("${MYX_CMAKE_TOOLCHAINS_DIR}/GCC.cmake") +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + include("${MYX_CMAKE_TOOLCHAINS_DIR}/Clang.cmake") +endif() + +if((MYX_CMAKE_LSB_DISTRIBUTOR_ID STREQUAL "AstraLinuxSE") AND + (MYX_CMAKE_LSB_CODENAME STREQUAL "smolensk") AND + (MYX_CMAKE_LSB_RELEASE_VERSION STREQUAL "1.5")) + include("${MYX_CMAKE_TOOLCHAINS_DIR}/AstraLinuxSE-1.5.cmake") + return() +endif() + +if((MYX_CMAKE_LSB_DISTRIBUTOR_ID STREQUAL "ElbrusD") AND + (MYX_CMAKE_LSB_CODENAME STREQUAL "Jessie") AND + (MYX_CMAKE_LSB_RELEASE_VERSION VERSION_GREATER "1.4")) + include("${MYX_CMAKE_TOOLCHAINS_DIR}/ElbrusD-1.4.cmake") + return() +endif() diff --git a/MyxCMake/lib/toolchains/AstraLinuxSE-1.5.cmake b/MyxCMake/lib/toolchains/AstraLinuxSE-1.5.cmake new file mode 100644 index 0000000..df9db4a --- /dev/null +++ b/MyxCMake/lib/toolchains/AstraLinuxSE-1.5.cmake @@ -0,0 +1,8 @@ +find_program(CMAKE_AR NAMES "/usr/bin/x86_64-linux-gnu-gcc-ar-4.7") +find_program(CMAKE_NM NAMES "/usr/bin/x86_64-linux-gnu-gcc-nm-4.7") +find_program(CMAKE_RANLIB NAMES "/usr/bin/x86_64-linux-gnu-gcc-ranlib-4.7") + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_EXTENSIONS ON) +check_enable_cxx_compiler_flag(-Wno-shadow) + diff --git a/MyxCMake/lib/toolchains/Clang.cmake b/MyxCMake/lib/toolchains/Clang.cmake new file mode 100644 index 0000000..e5f1d62 --- /dev/null +++ b/MyxCMake/lib/toolchains/Clang.cmake @@ -0,0 +1,3 @@ +if(CMAKE_COLOR_MAKEFILE) + check_enable_cxx_compiler_flag(-fcolor-diagnostics) +endif() diff --git a/MyxCMake/lib/toolchains/ElbrusD-1.4.cmake b/MyxCMake/lib/toolchains/ElbrusD-1.4.cmake new file mode 100644 index 0000000..29b46c6 --- /dev/null +++ b/MyxCMake/lib/toolchains/ElbrusD-1.4.cmake @@ -0,0 +1,9 @@ +find_program(CMAKE_AR NAMES "/usr/${CMAKE_SYSTEM_PROCESSOR}-linux/bin/ar") +find_program(CMAKE_NM NAMES "/usr/${CMAKE_SYSTEM_PROCESSOR}-linux/bin/nm") +find_program(CMAKE_RANLIB NAMES "/usr/${CMAKE_SYSTEM_PROCESSOR}-linux/bin/ranlib") + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_EXTENSIONS ON) +check_enable_cxx_compiler_flag(-Wno-invalid-offsetof) +list(APPEND CMAKE_LIBRARY_PATH "/usr/lib/e2k-linux-gnu") + diff --git a/MyxCMake/lib/toolchains/GCC.cmake b/MyxCMake/lib/toolchains/GCC.cmake new file mode 100644 index 0000000..3ac7ec8 --- /dev/null +++ b/MyxCMake/lib/toolchains/GCC.cmake @@ -0,0 +1,3 @@ +if(CMAKE_COLOR_MAKEFILE) + check_enable_cxx_compiler_flag(-fdiagnostics-color=auto) +endif() diff --git a/README.md b/README.md index cde551a..d0544c6 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Установка В корневом каталоге проекта создать каталог `cmake` и распаковать в него -[архив](../../../releases/download/2.0.33/myx-cmake-local-2.0.33.tar.xz ). +[архив](../../../releases/download/2.1.92/myx-cmake-local-2.1.92.tar.xz ). ## Использование diff --git a/VERSION b/VERSION index 520d2d2..a048613 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.33 +2.1.92 diff --git a/debian/CMakeLists.txt b/debian/CMakeLists.txt index ecffec7..9246497 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.0.33 LANGUAGES) +project(myx-cmake VERSION 2.1.92 LANGUAGES) include(GNUInstallDirs) file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake diff --git a/debian/changelog b/debian/changelog index eb4b55f..b71dd77 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -myx-cmake (2.0.33) unstable; urgency=medium +myx-cmake (2.1.92) unstable; urgency=medium * New version. diff --git a/myx_setup.cmake b/myx_setup.cmake index 6f254ba..33013a9 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.0.33 REQUIRED CONFIG PATHS ${MYX_CMAKE_DIR} NO_DEFAULT_PATH) + find_package(MyxCMake 2.1.92 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.0.33 REQUIRED) + find_package(MyxCMake 2.1.92 REQUIRED) myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===") else() include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)