0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-26 23:01:04 +08:00

Problem: CMake does not look for NSS using pkg-config

Solution: use pkg-config by default and FindPackage only as a
fallback
This commit is contained in:
Luca Boccassi 2019-12-28 15:37:07 +01:00
parent 068385c951
commit 2c2ff01e85

View File

@ -29,6 +29,8 @@ include(TestZMQVersion)
include(ZMQSourceRunChecks)
include(ZMQSupportMacros)
find_package(PkgConfig)
option(ENABLE_ASAN "Build with address sanitizer" OFF)
if(ENABLE_ASAN)
message(STATUS "Instrumenting with Address Sanitizer")
@ -120,17 +122,23 @@ if (NOT DISABLE_WS)
set(ZMQ_HAVE_WS 1)
if (WITH_NSS)
find_package("NSS3")
pkg_check_modules(NSS3 "nss")
if (NSS3_FOUND)
message(STATUS "Using NSS")
include_directories(${NSS3_INCLUDE_DIRS})
set(pkg_config_names_private "${pkg_config_names_private} nss3")
set(pkg_config_libs_private "${pkg_config_libs_private} -lnss3")
set(ZMQ_USE_NSS 1)
set(pkg_config_names_private "${pkg_config_names_private} nss")
else()
message(FATAL_ERROR
"nss is not installed. Install it, then run CMake again")
find_package("NSS3")
if (NSS3_FOUND)
set(pkg_config_libs_private "${pkg_config_libs_private} -lnss3")
else()
message(FATAL_ERROR
"nss is not installed. Install it, then run CMake again")
endif()
endif()
message(STATUS "Using NSS")
include_directories(${NSS3_INCLUDE_DIRS})
link_directories(${NSS3_LIBRARY_DIRS})
set(OPTIONAL_LIBRARIES ${NSS3_LIBRARIES})
set(ZMQ_USE_NSS 1)
else()
list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/external/sha1/sha1.c ${CMAKE_CURRENT_SOURCE_DIR}/external/sha1/sha1.h)
message("Using builtin sha1")
@ -139,7 +147,6 @@ if (NOT DISABLE_WS)
endif()
if(NOT MSVC)
find_package(PkgConfig)
option(WITH_LIBBSD "Use libbsd instead of builtin strlcpy" ON)
if (WITH_LIBBSD)
pkg_check_modules(LIBBSD "libbsd")