myx-cmake/MyxCMake/modules/MyxCMakeCompiler.cmake

65 lines
2.3 KiB
CMake

# C compiler name
if(CMAKE_C_COMPILER_ID STREQUAL "Intel")
set(CMAKE_C_COMPILER_IS_INTEL ON)
elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_C_COMPILER_ID STREQUAL
"AppleClang")
set(CMAKE_C_COMPILER_IS_CLANG ON)
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
set(CMAKE_C_COMPILER_IS_GCC ON)
elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_C_COMPILER_IS_MSVC ON)
endif()
# C++ compiler name
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(CMAKE_CXX_COMPILER_IS_INTEL ON)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL
"AppleClang")
set(CMAKE_CXX_COMPILER_IS_CLANG ON)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_COMPILER_IS_GCC ON)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_CXX_COMPILER_IS_MSVC ON)
endif()
# Предпочтительные пути к утилитам для компоновки
if(CMAKE_CXX_COMPILER_IS_GCC)
# 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 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")
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()
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()