Skip to content

Commit

Permalink
Fix configuration error in absence of lsb_release (#190)
Browse files Browse the repository at this point in the history
This makes that, in absence of `lsb_release`, `DISTRO_NAME` is set to
`Unknown`. A warning message is printed out
  • Loading branch information
RafaelPalomar authored Sep 22, 2023
1 parent 43f54df commit 5bf6ff6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions cmake/Package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,15 @@ else()

# Get distro name and version
find_program(LSB_RELEASE_EXEC lsb_release)
execute_process(COMMAND ${LSB_RELEASE_EXEC} -is
OUTPUT_VARIABLE DISTRO_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(LSB_RELEASE_EXEC)
execute_process(COMMAND ${LSB_RELEASE_EXEC} -is
OUTPUT_VARIABLE DISTRO_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else()
set(DISTRO_NAME "Unknown")
message(WARNING "lsb_release not found. DISTRO_NAME set to Unknown")
endif()
string(TOLOWER ${DISTRO_NAME} DISTRO_NAME)
execute_process(COMMAND ${LSB_RELEASE_EXEC} -rs
OUTPUT_VARIABLE DISTRO_VERSION
Expand Down

0 comments on commit 5bf6ff6

Please sign in to comment.