myx/MyxCMake/lib/Toolchains.cmake

57 lines
1.8 KiB
CMake
Raw Normal View History

2022-10-06 23:49:02 +00:00
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()
2022-10-23 16:38:59 +00:00
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()