forked from lijiext/lammps
Detect linux distribution and version
This commit is contained in:
parent
8aed7e55b3
commit
d5661e06ae
|
@ -104,3 +104,13 @@ function(FetchPotentials pkgfolder potfolder)
|
|||
endforeach()
|
||||
endif()
|
||||
endfunction(FetchPotentials)
|
||||
|
||||
# set CMAKE_LINUX_DISTRO and CMAKE_DISTRO_VERSION on Linux
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL Linux) AND (EXISTS /etc/os-release))
|
||||
file(STRINGS /etc/os-release distro REGEX "^NAME=")
|
||||
string(REGEX REPLACE "NAME=\"?([^\"]*)\"?" "\\1" distro "${distro}")
|
||||
file(STRINGS /etc/os-release disversion REGEX "^VERSION_ID=")
|
||||
string(REGEX REPLACE "VERSION_ID=\"?([^\"]*)\"?" "\\1" disversion "${disversion}")
|
||||
set(CMAKE_LINUX_DISTRO ${distro})
|
||||
set(CMAKE_DISTRO_VERSION ${disversion})
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue