libnetconf2 CHANGE QNX compatibility (#220)
fixes #217
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ad7880a..f43ef03 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -251,8 +251,13 @@
include_directories(${LIBSSH_INCLUDE_DIRS})
# crypt
- target_link_libraries(netconf2 -lcrypt)
- list(APPEND CMAKE_REQUIRED_LIBRARIES crypt)
+ if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "QNX")
+ target_link_libraries(netconf2 -lcrypt)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES crypt)
+ else()
+ target_link_libraries(netconf2 -llogin)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES login)
+ endif()
endif()
# dependencies - libval
@@ -268,6 +273,20 @@
target_link_libraries(netconf2 ${LIBYANG_LIBRARIES})
include_directories(${LIBYANG_INCLUDE_DIRS})
+# header file compatibility - shadow.h and crypt.h
+check_include_file("shadow.h" HAVE_SHADOW)
+check_include_file("crypt.h" HAVE_CRYPT)
+
+# function compatibility - getpeereid on QNX
+if(${CMAKE_SYSTEM_NAME} MATCHES "QNX")
+ target_link_libraries(netconf2 -lsocket)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES socket)
+ list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES pthread)
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_QNX_SOURCE)
+ check_symbol_exists(getpeereid "sys/types.h;unistd.h" HAVE_GETPEEREID)
+ list(REMOVE_ITEM CMAKE_REQUIRED_DEFINITIONS -D_QNX_SOURCE)
+endif()
+
# generate doxygen documentation for libnetconf2 API
find_package(Doxygen)
if(DOXYGEN_FOUND)