Skip to content

Commit

Permalink
cmake UPDATE try find crypt lib first
Browse files Browse the repository at this point in the history
Because on Ubuntu 22, the function is
found (and can supposedly be used) without
linking any additional library but then
the sanitizers crash for some weird reason.
  • Loading branch information
michalvasko committed Apr 26, 2024
1 parent 4a1ea9e commit 7bff575
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -246,20 +246,16 @@ if(ENABLE_SSH_TLS)
find_package(CURL 7.30.0 REQUIRED)
target_link_libraries(netconf2 CURL::libcurl)

# crypt
check_function_exists(crypt HAVE_CRYPT_NOLIB)
if(NOT HAVE_CRYPT_NOLIB)
# we may need to link it explicitly
if(${CMAKE_SYSTEM_NAME} MATCHES "QNX")
set(LIBCRYPT login)
else()
set(LIBCRYPT crypt)
endif()
check_library_exists(${LIBCRYPT} crypt "" HAVE_CRYPT)
if(HAVE_CRYPT)
target_link_libraries(netconf2 ${LIBCRYPT})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBCRYPT})
endif()
# crypt (if not found, assume no library needs to be linked)
if(${CMAKE_SYSTEM_NAME} MATCHES "QNX")
set(LIBCRYPT login)
else()
set(LIBCRYPT crypt)
endif()
check_library_exists(${LIBCRYPT} crypt "" HAVE_CRYPT)
if(HAVE_CRYPT)
target_link_libraries(netconf2 ${LIBCRYPT})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBCRYPT})
endif()

# libpam
Expand Down

0 comments on commit 7bff575

Please sign in to comment.