Skip to content

Commit b44d125

Browse files
committed
[cmake] define STRERROR_R_CHAR_P
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
1 parent 77aa065 commit b44d125

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/config/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,5 +294,14 @@ endif()
294294

295295
check_type_size(__int128 __INT128)
296296

297+
check_cxx_source_compiles("
298+
#include <string.h>
299+
int main() {
300+
char buf[100];
301+
char* p{strerror_r(0, buf, sizeof buf)};
302+
(void)p;
303+
}
304+
" STRERROR_R_CHAR_P)
305+
297306
# Generate the config
298307
configure_file(bitcoin-config.h.cmake.in bitcoin-config.h ESCAPE_QUOTES)

src/config/bitcoin-config.h.cmake.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,7 @@
105105

106106
#cmakedefine ENABLE_TRACING 1
107107

108+
/* Define to 1 if strerror_r returns char *. */
109+
#cmakedefine STRERROR_R_CHAR_P 1
110+
108111
#endif // BITCOIN_BITCOIN_CONFIG_H

0 commit comments

Comments
 (0)