2020-01-13 00:49:00 +00:00
|
|
|
# Copyright (C) 2020 (see AUTHORS file for a list of contributors)
|
|
|
|
#
|
2020-02-11 23:04:29 +00:00
|
|
|
# GNSS-SDR is a software-defined Global Navigation Satellite Systems receiver
|
|
|
|
#
|
2020-01-13 00:49:00 +00:00
|
|
|
# This file is part of GNSS-SDR.
|
|
|
|
#
|
2020-02-08 00:20:02 +00:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
2020-01-13 00:49:00 +00:00
|
|
|
|
|
|
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
2020-02-03 21:11:04 +00:00
|
|
|
set(ARCHITECTURE_STRING "(64 bits)")
|
2020-01-13 00:49:00 +00:00
|
|
|
else()
|
2020-02-03 21:11:04 +00:00
|
|
|
set(ARCHITECTURE_STRING "(32 bits)")
|
2020-01-13 00:49:00 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(EXISTS "/etc/lsb-release")
|
|
|
|
execute_process(COMMAND cat /etc/lsb-release
|
|
|
|
COMMAND grep DISTRIB_ID
|
|
|
|
COMMAND awk -F= "{ print $2 }"
|
|
|
|
COMMAND tr "\n" " "
|
|
|
|
COMMAND sed "s/ //"
|
|
|
|
OUTPUT_VARIABLE LINUX_DISTRIBUTION
|
|
|
|
RESULT_VARIABLE LINUX_ID_RESULT
|
|
|
|
)
|
|
|
|
execute_process(COMMAND cat /etc/lsb-release
|
|
|
|
COMMAND grep DISTRIB_RELEASE
|
|
|
|
COMMAND awk -F= "{ print $2 }"
|
|
|
|
COMMAND tr "\n" " "
|
|
|
|
COMMAND sed "s/ //"
|
|
|
|
OUTPUT_VARIABLE LINUX_VER
|
|
|
|
RESULT_VARIABLE LINUX_VER_RESULT
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT LINUX_DISTRIBUTION)
|
|
|
|
if(EXISTS "/etc/linuxmint/info")
|
|
|
|
set(LINUX_DISTRIBUTION "LinuxMint")
|
|
|
|
execute_process(COMMAND cat /etc/linuxmint/info
|
|
|
|
COMMAND grep -m1 RELEASE
|
|
|
|
COMMAND awk -F= "{ print $2 }"
|
|
|
|
COMMAND tr "\n" " "
|
|
|
|
COMMAND sed "s/ //"
|
|
|
|
OUTPUT_VARIABLE LINUX_VER
|
|
|
|
RESULT_VARIABLE LINUX_VER_RESULT
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT LINUX_DISTRIBUTION)
|
|
|
|
if(EXISTS "/etc/os-release")
|
|
|
|
execute_process(COMMAND cat /etc/os-release
|
|
|
|
COMMAND grep -m1 NAME
|
|
|
|
COMMAND awk -F= "{ print $2 }"
|
|
|
|
COMMAND tr "\n" " "
|
|
|
|
COMMAND sed "s/ //"
|
2020-02-03 21:11:04 +00:00
|
|
|
OUTPUT_VARIABLE LINUX_DISTRIBUTION_
|
2020-01-13 00:49:00 +00:00
|
|
|
RESULT_VARIABLE LINUX_ID_RESULT
|
|
|
|
)
|
|
|
|
execute_process(COMMAND cat /etc/os-release
|
|
|
|
COMMAND grep VERSION_ID
|
|
|
|
COMMAND awk -F= "{ print $2 }"
|
|
|
|
COMMAND tr "\n" " "
|
|
|
|
COMMAND sed "s/ //"
|
2020-02-03 21:11:04 +00:00
|
|
|
OUTPUT_VARIABLE LINUX_VER_
|
2020-01-13 00:49:00 +00:00
|
|
|
RESULT_VARIABLE LINUX_VER_RESULT
|
|
|
|
)
|
2020-02-03 21:11:04 +00:00
|
|
|
if(LINUX_DISTRIBUTION_)
|
2020-02-03 22:31:50 +00:00
|
|
|
string(REPLACE "\"" "" LINUX_DISTRIBUTION__ ${LINUX_DISTRIBUTION_})
|
|
|
|
string(STRIP ${LINUX_DISTRIBUTION__} LINUX_DISTRIBUTION)
|
2020-02-03 21:11:04 +00:00
|
|
|
endif()
|
|
|
|
if(LINUX_VER_)
|
|
|
|
string(REPLACE "\"" "" LINUX_VER ${LINUX_VER_})
|
|
|
|
endif()
|
2020-01-13 00:49:00 +00:00
|
|
|
if(${LINUX_DISTRIBUTION} MATCHES "Debian")
|
|
|
|
set(LINUX_DISTRIBUTION "Debian")
|
2020-02-03 21:11:04 +00:00
|
|
|
file(READ /etc/debian_version LINUX_VER_)
|
|
|
|
string(REPLACE "\n" "" LINUX_VER ${LINUX_VER_})
|
2020-01-13 00:49:00 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT LINUX_DISTRIBUTION)
|
|
|
|
if(EXISTS "/etc/redhat-release")
|
|
|
|
set(LINUX_DISTRIBUTION "Red Hat")
|
2020-02-03 21:11:04 +00:00
|
|
|
file(READ /etc/redhat-release LINUX_VER_)
|
|
|
|
string(REPLACE "\n" "" LINUX_VER ${LINUX_VER_})
|
2020-01-13 00:49:00 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT LINUX_DISTRIBUTION)
|
|
|
|
if(EXISTS "/etc/debian_version")
|
|
|
|
set(LINUX_DISTRIBUTION "Debian")
|
2020-02-03 21:11:04 +00:00
|
|
|
file(READ /etc/debian_version LINUX_VER_)
|
|
|
|
string(REPLACE "\n" "" LINUX_VER ${LINUX_VER_})
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT LINUX_DISTRIBUTION)
|
|
|
|
if(EXISTS "/etc/arch-release")
|
|
|
|
set(LINUX_DISTRIBUTION "Arch Linux")
|
|
|
|
set(LINUX_VER "")
|
2020-01-13 00:49:00 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT LINUX_DISTRIBUTION)
|
|
|
|
set(LINUX_DISTRIBUTION "Generic")
|
|
|
|
set(LINUX_VER "Unknown")
|
|
|
|
endif()
|