X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=CMakeVersions.txt;h=965c1106dce5204d9f72630eaeb762dcba829e41;hb=85f5404daca70a8bc772c5e0670b22f68ad9d76d;hp=dd2e7ed6404eea934f0cdf8a4a027847caa9eb4a;hpb=3ffc968aaf182bf1ff1e18157c7bde2bdb41668d;p=m6w6%2Flibmemcached diff --git a/CMakeVersions.txt b/CMakeVersions.txt index dd2e7ed6..965c1106 100644 --- a/CMakeVersions.txt +++ b/CMakeVersions.txt @@ -1,15 +1,18 @@ function(to_hex HEX) + # mind you, not really hexadecimal, but just a decimal in hex notation, huh?! set(XNUMBER 0x) - set(XDIGITS 0 1 2 3 4 5 6 7 8 9 a b c d e f) foreach(DEC IN LISTS ARGN) - if(${DEC} GREATER 255) - message(WARNING "to_hex(HEX ${DEC}): decimal number out of uint8 range (>=256)") + while(1) + string(LENGTH "${DEC}" LEN) + if(LEN GREATER_EQUAL 3) + break() + endif() + string(CONCAT DEC "0" "${DEC}") + endwhile() + if(DEC GREATER 999) + message(WARNING "to_hex(HEX ${DEC}): decimal wider than 3 digits") endif() - math(EXPR HIDEC "${DEC} / 16") - math(EXPR LODEC "${DEC} % 16") - list(GET XDIGITS ${HIDEC} HIHEX) - list(GET XDIGITS ${LODEC} LOHEX) - string(APPEND XNUMBER ${HIHEX}${LOHEX}) + string(APPEND XNUMBER ${DEC}) endforeach() set(${HEX} ${XNUMBER} PARENT_SCOPE) endfunction()