From 0ab40dc1ab4e689921da54080b135e1d22b1c586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Tue, 14 Mar 2017 21:45:23 +0100 Subject: Refactoring louloulibs and cmake Use OBJECT libraries Remove the louloulibs directory Write FOUND variables in the cache --- src/utils/system.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/utils/system.cpp (limited to 'src/utils/system.cpp') diff --git a/src/utils/system.cpp b/src/utils/system.cpp new file mode 100644 index 0000000..c0bee11 --- /dev/null +++ b/src/utils/system.cpp @@ -0,0 +1,21 @@ +#include +#include +#include +#include + +using namespace std::string_literals; + +namespace utils +{ +std::string get_system_name() +{ + struct utsname uts; + const int res = ::uname(&uts); + if (res == -1) + { + log_error("uname failed: ", std::strerror(errno)); + return "Unknown"; + } + return uts.sysname + " "s + uts.release; +} +} \ No newline at end of file -- cgit v1.2.3