Skip to content

Commit

Permalink
Update CMakeLists.txt
Browse files Browse the repository at this point in the history
fixes obs builds
  • Loading branch information
rdementi committed Jul 11, 2024
1 parent afa0c63 commit b76833e
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ else()
endif()

if (LINUX)
file(STRINGS "/etc/os-release" OS_RELEASE_CONTENTS)
foreach(LINE ${OS_RELEASE_CONTENTS})
if(LINE MATCHES "^ID=")
string(REGEX REPLACE "^ID=\"?\([a-zA-Z]+\)\"?" "\\1" OS_ID ${LINE})
endif()
endforeach()
message(STATUS "Detected Linux distribution: ${OS_ID}")
if(EXISTS "/etc/os-release" AND IS_READABLE "/etc/os-release")
file(STRINGS "/etc/os-release" OS_RELEASE_CONTENTS)
foreach(LINE ${OS_RELEASE_CONTENTS})
if(LINE MATCHES "^ID=")
string(REGEX REPLACE "^ID=\"?\([a-zA-Z]+\)\"?" "\\1" OS_ID ${LINE})
endif()
endforeach()
message(STATUS "Detected Linux distribution: ${OS_ID}")
else()
message(STATUS "Unable to read /etc/os-release")
endif()
endif()

if(NOT DEFINED NO_ASAN)
Expand Down

0 comments on commit b76833e

Please sign in to comment.