myx/MyxCMake/lib/Toolchains.cmake
2023-09-14 14:44:47 +03:00

72 lines
2.5 KiB
CMake

include_guard(GLOBAL)
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
set(MYX_CMAKE_LSB_DISTRIBUTOR_ID "unknown")
set(MYX_CMAKE_LSB_CODENAME "unknown")
set(MYX_CMAKE_LSB_RELEASE_VERSION "unknown")
if(CMAKE_CROSSCOMPILING)
return()
endif()
if(EXISTS /etc/mcst_version)
set(MYX_CMAKE_LSB_DISTRIBUTOR_ID "ElbrusD")
set(MYX_CMAKE_LSB_CODENAME "Jessie")
execute_process(COMMAND cat /etc/mcst_version
OUTPUT_VARIABLE MYX_CMAKE_LSB_RELEASE_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
find_program(LSB_RELEASE_EXECUTABLE lsb_release)
# cmake-format: off
if(LSB_RELEASE_EXECUTABLE)
execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -si
OUTPUT_VARIABLE MYX_CMAKE_LSB_DISTRIBUTOR_ID
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -sc
OUTPUT_VARIABLE MYX_CMAKE_LSB_CODENAME
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -sr
OUTPUT_VARIABLE MYX_CMAKE_LSB_RELEASE_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
# cmake-format: on
endif()
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
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()
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_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)
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"))
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")
endif()