-
Notifications
You must be signed in to change notification settings - Fork 538
Description
Hey, guys! I am back again.
I am trying to add czmq to vcpkg these days(microsoft/vcpkg#4979). When building czmq with CMake, I encountered several problems.
-
CMAKE_CURRENT_SOURCE_DIRisn't inCMAKE_MODULE_PATH.https://github.com/zeromq/czmq/blob/master/CMakeLists.txt#L19soFindlibzmq.cmake,Findlibsodium.cmake, .etc. may not be called. -
When built as a static library, libzmq will set an additional compiler flag-DZMQ_STATICthroughset_target_properties:https://github.com/zeromq/libzmq/blob/master/CMakeLists.txt#L1060so if we want to buildczmqas a static library on Windows, we should defineZMQ_STATICmanually(Maybe we can define it inFindlibzmq.cmake). Otherwise, the build will fail: undefined reference in mingw when link static library. libzmq#3318 -
Findlibzmq.cmakeis not be able to findlibzmqon Windows.libzmq dll/lib built with MSVC is named using the Boost convention(something like
libzmq-mt-4_3_1.lib,libzmq-mt-4_3_1.dll). Sofind_library (LIBZMQ_LIBRARIES NAMES zmq HINTS ${PC_LIBZMQ_LIBRARY_HINTS})will not work.Here is a patch for solving this problem: https://bitbucket.org/ignitionrobotics/ign-transport/pull-requests/19/detec-zmq-under-windows-using-a-findzmq/diff
-
Findlibsodium.cmakewill not foundlibsodiumon WindowsWhen built with MSVC,
libsodiumwill generate a library namedlibsodium.dll/lib. In this case,find_library(LIBSODIUM_LIBRARY NAMES sodium)is not able to find the library. I found thatfind_library(LIBSODIUM_LIBRARY NAMES sodium libsodium)works.By the way,
Findlibcurl.cmakehas this problem too. -
Maybe we can add some options like:
WITH_LIBSODIUM
WITH_LIBCURL
WITH_LZ4
WITH_UUID
BUILD_TESTS(For example: Create a configuration flag to disable tests. googleapis/google-cloud-cpp#1617)
BUILD_TOOLS(zmakecret)