Skip to content

Commit

Permalink
[cmake] define STRERROR_R_CHAR_P
Browse files Browse the repository at this point in the history
Summary:
This var is used in sock.cpp (syserror.cpp after D16209) to pick the correct flavor of `strerror_r` but is never defined.
Define it.

This solution is based on hebasto/bitcoin#6

Test Plan:
```
cmake .. -GNinja
ninja
```

Check the var is set in build/CMakeCache.txt and build/src/config/bitcoin-config.h

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D16212
  • Loading branch information
PiRK committed May 23, 2024
1 parent 77aa065 commit b44d125
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -294,5 +294,14 @@ endif()

check_type_size(__int128 __INT128)

check_cxx_source_compiles("
#include <string.h>
int main() {
char buf[100];
char* p{strerror_r(0, buf, sizeof buf)};
(void)p;
}
" STRERROR_R_CHAR_P)

# Generate the config
configure_file(bitcoin-config.h.cmake.in bitcoin-config.h ESCAPE_QUOTES)
3 changes: 3 additions & 0 deletions src/config/bitcoin-config.h.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,7 @@

#cmakedefine ENABLE_TRACING 1

/* Define to 1 if strerror_r returns char *. */
#cmakedefine STRERROR_R_CHAR_P 1

#endif // BITCOIN_BITCOIN_CONFIG_H

0 comments on commit b44d125

Please sign in to comment.