This commit is contained in:
Andrei Astafev 2022-10-23 19:38:59 +03:00
parent df56d476f4
commit b0dc31b1d5
17 changed files with 61 additions and 79 deletions

View File

@ -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)

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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)

View File

@ -0,0 +1,3 @@
if(CMAKE_COLOR_MAKEFILE)
check_enable_cxx_compiler_flag(-fcolor-diagnostics)
endif()

View File

@ -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")

View File

@ -0,0 +1,3 @@
if(CMAKE_COLOR_MAKEFILE)
check_enable_cxx_compiler_flag(-fdiagnostics-color=auto)
endif()

View File

@ -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 ).
## Использование

View File

@ -1 +1 @@
2.0.33
2.1.92

View File

@ -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

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
myx-cmake (2.0.33) unstable; urgency=medium
myx-cmake (2.1.92) unstable; urgency=medium
* New version.

View File

@ -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)