myx-cmake-example-features/cmake/myx/lib/Toolchain.cmake
2022-10-07 15:02:38 +03:00

36 lines
1.4 KiB
CMake

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