Skip to content

Commit

Permalink
Update CMakeLists.txt (#784)
Browse files Browse the repository at this point in the history
* Update CMakeLists.txt

fixes obs builds
  • Loading branch information
rdementi authored Jul 11, 2024
1 parent afa0c63 commit dbe28ec
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" (3.29 cmake required :-( )
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 dbe28ec

Please sign in to comment.