diff options
author | Viktor Szakats <commit@vsz.me> | 2023-12-11 16:21:30 +0000 |
---|---|---|
committer | Brent Cook <busterb@gmail.com> | 2024-03-03 15:32:50 -0600 |
commit | b85c9dacd550c07cd4f259a9efb2f3f6164936d4 (patch) | |
tree | 8d9ef1500858281db49649cb0c4446aebd62800e | |
parent | c4034613ca29c0676555181cf77b86e07d67ecba (diff) | |
download | portable-b85c9dacd550c07cd4f259a9efb2f3f6164936d4.tar.gz portable-b85c9dacd550c07cd4f259a9efb2f3f6164936d4.tar.bz2 portable-b85c9dacd550c07cd4f259a9efb2f3f6164936d4.zip |
cmake: auto-detect `strtonum`
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: https://github.com/libressl/portable/issues/928#issuecomment-1850178282
Ref: https://github.com/libressl/portable/issues/928#issuecomment-1850276298
Prerequisite:
https://github.com/libressl/portable/issues/928#issuecomment-1850356408
-rw-r--r-- | CMakeLists.txt | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 605cfde..ac3e5a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -234,6 +234,11 @@ if(HAVE_STRSEP) | |||
234 | add_definitions(-DHAVE_STRSEP) | 234 | add_definitions(-DHAVE_STRSEP) |
235 | endif() | 235 | endif() |
236 | 236 | ||
237 | check_function_exists(strtonum HAVE_STRTONUM) | ||
238 | if(HAVE_STRTONUM) | ||
239 | add_definitions(-DHAVE_STRTONUM) | ||
240 | endif() | ||
241 | |||
237 | check_function_exists(timegm HAVE_TIMEGM) | 242 | check_function_exists(timegm HAVE_TIMEGM) |
238 | if(HAVE_TIMEGM) | 243 | if(HAVE_TIMEGM) |
239 | add_definitions(-DHAVE_TIMEGM) | 244 | add_definitions(-DHAVE_TIMEGM) |