0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-27 15:41:05 +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(ZMQSourceRunChecks)
include(ZMQSupportMacros) include(ZMQSupportMacros)
find_package(PkgConfig)
option(ENABLE_ASAN "Build with address sanitizer" OFF) option(ENABLE_ASAN "Build with address sanitizer" OFF)
if(ENABLE_ASAN) if(ENABLE_ASAN)
message(STATUS "Instrumenting with Address Sanitizer") message(STATUS "Instrumenting with Address Sanitizer")
@ -120,17 +122,23 @@ if (NOT DISABLE_WS)
set(ZMQ_HAVE_WS 1) set(ZMQ_HAVE_WS 1)
if (WITH_NSS) if (WITH_NSS)
pkg_check_modules(NSS3 "nss")
if (NSS3_FOUND)
set(pkg_config_names_private "${pkg_config_names_private} nss")
else()
find_package("NSS3") find_package("NSS3")
if (NSS3_FOUND) 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(pkg_config_libs_private "${pkg_config_libs_private} -lnss3")
set(ZMQ_USE_NSS 1)
else() else()
message(FATAL_ERROR message(FATAL_ERROR
"nss is not installed. Install it, then run CMake again") "nss is not installed. Install it, then run CMake again")
endif() 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() else()
list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/external/sha1/sha1.c ${CMAKE_CURRENT_SOURCE_DIR}/external/sha1/sha1.h) list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/external/sha1/sha1.c ${CMAKE_CURRENT_SOURCE_DIR}/external/sha1/sha1.h)
message("Using builtin sha1") message("Using builtin sha1")
@ -139,7 +147,6 @@ if (NOT DISABLE_WS)
endif() endif()
if(NOT MSVC) if(NOT MSVC)
find_package(PkgConfig)
option(WITH_LIBBSD "Use libbsd instead of builtin strlcpy" ON) option(WITH_LIBBSD "Use libbsd instead of builtin strlcpy" ON)
if (WITH_LIBBSD) if (WITH_LIBBSD)
pkg_check_modules(LIBBSD "libbsd") pkg_check_modules(LIBBSD "libbsd")