1# Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2# file Copyright.txt or https://cmake.org/licensing for details. 3 4# Author: Alex Turbov 5 6if(NOT EXISTS "${CMAKE_SYSROOT}/etc/debian_version") 7 return() 8endif() 9 10# Get the first string only 11file( 12 STRINGS "${CMAKE_SYSROOT}/etc/debian_version" CMAKE_GET_OS_RELEASE_FALLBACK_CONTENT 13 LIMIT_COUNT 1 14 ) 15 16# 17# Example: 18# 6.0.10 # Old debian 19# wheezy/sid # Ubuntu 20# 21if(CMAKE_GET_OS_RELEASE_FALLBACK_CONTENT MATCHES "[0-9]+(\.[0-9]+)*") 22 23 set(CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_NAME Debian) 24 set(CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_ID debian) 25 set(CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION ${CMAKE_GET_OS_RELEASE_FALLBACK_CONTENT}) 26 set(CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION_ID ${CMAKE_GET_OS_RELEASE_FALLBACK_CONTENT}) 27 28 list( 29 APPEND CMAKE_GET_OS_RELEASE_FALLBACK_RESULT 30 CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_NAME 31 CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_ID 32 CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION 33 CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION_ID 34 ) 35 36endif() 37 38unset(CMAKE_GET_OS_RELEASE_FALLBACK_CONTENT) 39