Commit 2c2ff01e authored by Luca Boccassi's avatar Luca Boccassi

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

Solution: use pkg-config by default and FindPackage only as a
fallback
parent 068385c9
......@@ -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")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment