-
Notifications
You must be signed in to change notification settings - Fork 539
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_DIR
isn'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_STATIC
throughset_target_properties
:https://github.com/zeromq/libzmq/blob/master/CMakeLists.txt#L1060so if we want to buildczmq
as a static library on Windows, we should defineZMQ_STATIC
manually(Maybe we can define it inFindlibzmq.cmake
). Otherwise, the build will fail: undefined reference in mingw when link static library. libzmq#3318 -
Findlibzmq.cmake
is not be able to findlibzmq
on 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.cmake
will not foundlibsodium
on WindowsWhen built with MSVC,
libsodium
will 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.cmake
has 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)