Skip to content

Commit

Permalink
cmake: auto-detect strtonum
Browse files Browse the repository at this point in the history
Notice that just like in autotools, this detection also doesn't take
into account the targeted OS version. Meaning it detects `strtonum` even
if targeting e.g. macOS older than release v11 Big Sur (which introduced
this funcitions), if the SDK declares it. Wrong detection will either
cause a binary broken on older macOS and/or trigger compiler warnings.

Ref: libressl#928 (comment)
Ref: libressl#928 (comment)

Prerequisite:
libressl#928 (comment)
  • Loading branch information
vszakats authored and busterb committed Mar 3, 2024
1 parent 011b581 commit 7a0830f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ if(HAVE_STRSEP)
add_definitions(-DHAVE_STRSEP)
endif()

check_function_exists(strtonum HAVE_STRTONUM)
if(HAVE_STRTONUM)
add_definitions(-DHAVE_STRTONUM)
endif()

check_function_exists(timegm HAVE_TIMEGM)
if(HAVE_TIMEGM)
add_definitions(-DHAVE_TIMEGM)
Expand Down

0 comments on commit 7a0830f

Please sign in to comment.