File tree Expand file tree Collapse file tree 1 file changed +10
-14
lines changed
Expand file tree Collapse file tree 1 file changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -126,21 +126,17 @@ target_include_directories(
126126 PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR} >
127127 PUBLIC $<BUILD_INTERFACE:${PROJECT_BINARY_DIR} /install -include >)
128128
129- file (WRITE "${CMAKE_CURRENT_BINARY_DIR} /pollrdhup.c"
130- [=[
131- #define _GNU_SOURCE
132- #include <poll.h>
133- int main() {
134- printf("0x%x", POLLRDHUP);
135- return 0;
136- }
137- ]=])
138- try_run (HAVE_POLLRDHUP_RUN_RESULT HAVE_POLLRDHUP
139- "${CMAKE_CURRENT_BINARY_DIR} "
140- "${CMAKE_CURRENT_BINARY_DIR} /pollrdhup.c"
141- RUN_OUTPUT_VARIABLE POLLRDHUP_VALUE)
142- if (NOT HAVE_POLLRDHUP)
129+ include (CMakePushCheckState)
130+ cmake_push_check_state()
131+ set (CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
132+ set (CMAKE_EXTRA_INCLUDE_FILES poll.h)
133+ check_type_size("((struct { char x[POLLRDHUP]\\ ; }*)0)->x" POLLRDHUP_VALUE)
134+ cmake_pop_check_state()
135+
136+ if (NOT POLLRDHUP_VALUE)
143137 set (POLLRDHUP_VALUE "0x2000" )
138+ else ()
139+ message (STATUS "Detected value of POLLRDHUP as ${POLLRDHUP_VALUE} " )
144140endif ()
145141
146142set (_headers
You can’t perform that action at this time.
0 commit comments