Skip to content

Commit

Permalink
Check for eventfd through check_function_exists
Browse files Browse the repository at this point in the history
instead the existance of the header file
  • Loading branch information
linkclau committed Jun 27, 2016
1 parent bcf284b commit 1504f8c
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,21 @@ find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR})
set(LIBS ${LIBS} ${OPENSSL_LIBRARIES})

find_package (Threads)
find_package (Threads REQUIRED)
set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT})

set( MAINSRC MainLinux.cpp )
set( SYSSRCS SysDepLinux.cpp SysDepUnix.cpp )

# On x86_64 it is actually
# /usr/include/x86_64-linux-gnu/sys/eventfd.h
# /usr/include/sys/eventfd.h
# SYSSRCS := $(SYSSRCS) SysOsEventfd_eventfd.cpp
# CFLAGS := $(CFLAGS) -DHAS_EVENTFD
# SYSSRCS := $(SYSSRCS) SysOsEventfd_pipe.cpp
set( SYSSRCS ${SYSSRCS} SysOsEventfd_eventfd.cpp )
add_definitions( -DHAS_EVENTFD )
include (CheckFunctionExists)
check_function_exists (eventfd HAS_EVENTFD)
if (HAS_EVENTFD)
set( SYSSRCS ${SYSSRCS} SysOsEventfd_eventfd.cpp )
add_definitions( -DHAS_EVENTFD )
else()
set( SYSSRCS ${SYSSRCS} SysOsEventfd_pipe.cpp )
endif(HAS_EVENTFD)



set( SVRSRCS ${MAINSRC} ${SYSSRCS}
Expand Down

0 comments on commit 1504f8c

Please sign in to comment.