-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem: Add options to control over optional libraries #1186
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This patch also: 1. Simplify Findlibzmq.cmake 2. Use both libname and linkname when they are not identical Related issue: zeromq/czmq#1972
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2d2b305a..8100d0cd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -138,7 +138,8 @@ ENDIF (LIBZMQ_FOUND)
# UUID dependency
########################################################################
find_package(uuid)
-IF (UUID_FOUND)
+option(CZMQ_WITH_UUID "Build czmq with uuid" ${UUID_FOUND})
+IF (CZMQ_WITH_UUID AND UUID_FOUND)
include_directories(${UUID_INCLUDE_DIRS})
list(APPEND MORE_LIBRARIES ${UUID_LIBRARIES})
IF (PC_UUID_FOUND)
@@ -149,13 +150,14 @@ IF (UUID_FOUND)
ENDIF (PC_UUID_FOUND)
add_definitions(-DHAVE_UUID)
list(APPEND OPTIONAL_LIBRARIES ${UUID_LIBRARIES})
-ENDIF (UUID_FOUND)
+ENDIF (CZMQ_WITH_UUID AND UUID_FOUND)
########################################################################
# SYSTEMD dependency
########################################################################
find_package(systemd)
-IF (SYSTEMD_FOUND)
+option(CZMQ_WITH_SYSTEMD "Build czmq with systemd" ${SYSTEMD_FOUND})
+IF (CZMQ_WITH_SYSTEMD AND SYSTEMD_FOUND)
include_directories(${SYSTEMD_INCLUDE_DIRS})
list(APPEND MORE_LIBRARIES ${SYSTEMD_LIBRARIES})
IF (PC_SYSTEMD_FOUND)
@@ -166,13 +168,14 @@ IF (SYSTEMD_FOUND)
ENDIF (PC_SYSTEMD_FOUND)
add_definitions(-DHAVE_LIBSYSTEMD)
list(APPEND OPTIONAL_LIBRARIES ${SYSTEMD_LIBRARIES})
-ENDIF (SYSTEMD_FOUND)
+ENDIF (CZMQ_WITH_SYSTEMD AND SYSTEMD_FOUND)
########################################################################
# LZ4 dependency
########################################################################
find_package(lz4)
-IF (LZ4_FOUND)
+option(CZMQ_WITH_LZ4 "Build czmq with lz4" ${LZ4_FOUND})
+IF (CZMQ_WITH_LZ4 AND LZ4_FOUND)
include_directories(${LZ4_INCLUDE_DIRS})
list(APPEND MORE_LIBRARIES ${LZ4_LIBRARIES})
IF (PC_LZ4_FOUND)
@@ -183,13 +186,14 @@ IF (LZ4_FOUND)
ENDIF (PC_LZ4_FOUND)
add_definitions(-DHAVE_LIBLZ4)
list(APPEND OPTIONAL_LIBRARIES ${LZ4_LIBRARIES})
-ENDIF (LZ4_FOUND)
+ENDIF (CZMQ_WITH_LZ4 AND LZ4_FOUND)
########################################################################
# LIBCURL dependency
########################################################################
find_package(libcurl)
-IF (LIBCURL_FOUND)
+option(CZMQ_WITH_LIBCURL "Build czmq with libcurl" ${LIBCURL_FOUND})
+IF (CZMQ_WITH_LIBCURL AND LIBCURL_FOUND)
include_directories(${LIBCURL_INCLUDE_DIRS})
list(APPEND MORE_LIBRARIES ${LIBCURL_LIBRARIES})
IF (PC_LIBCURL_FOUND)
@@ -200,13 +204,14 @@ IF (LIBCURL_FOUND)
ENDIF (PC_LIBCURL_FOUND)
add_definitions(-DHAVE_LIBCURL)
list(APPEND OPTIONAL_LIBRARIES ${LIBCURL_LIBRARIES})
-ENDIF (LIBCURL_FOUND)
+ENDIF (CZMQ_WITH_LIBCURL AND LIBCURL_FOUND)
########################################################################
# LIBMICROHTTPD dependency
########################################################################
find_package(libmicrohttpd)
-IF (LIBMICROHTTPD_FOUND)
+option(CZMQ_WITH_LIBMICROHTTPD "Build czmq with libmicrohttpd" ${LIBMICROHTTPD_FOUND})
+IF (CZMQ_WITH_LIBMICROHTTPD AND LIBMICROHTTPD_FOUND)
include_directories(${LIBMICROHTTPD_INCLUDE_DIRS})
list(APPEND MORE_LIBRARIES ${LIBMICROHTTPD_LIBRARIES})
IF (PC_LIBMICROHTTPD_FOUND)
@@ -217,7 +222,7 @@ IF (LIBMICROHTTPD_FOUND)
ENDIF (PC_LIBMICROHTTPD_FOUND)
add_definitions(-DHAVE_LIBMICROHTTPD)
list(APPEND OPTIONAL_LIBRARIES ${LIBMICROHTTPD_LIBRARIES})
-ENDIF (LIBMICROHTTPD_FOUND)
+ENDIF (CZMQ_WITH_LIBMICROHTTPD AND LIBMICROHTTPD_FOUND)
########################################################################
# version
|
Findlibzmq.cmake diff --git a/Findlibzmq.cmake b/Findlibzmq.cmake
index b8d16d1d..24f996a3 100644
--- a/Findlibzmq.cmake
+++ b/Findlibzmq.cmake
@@ -44,9 +44,6 @@ if (MSVC)
set(_zmq_version ${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH})
- set(_zmq_debug_names)
- set(_zmq_release_names)
-
set(_zmq_debug_names
"libzmq${MSVC_TOOLSET}-mt-gd-${_zmq_version}" # Debug, BUILD_SHARED
"libzmq${MSVC_TOOLSET}-mt-sgd-${_zmq_version}" # Debug, BUILD_STATIC
@@ -61,30 +58,22 @@ if (MSVC)
"libzmq-mt-s-${_zmq_version}" # Release|RelWithDebInfo|MinSizeRel, BUILD_STATIC
)
- find_library (ZeroMQ_LIBRARY_DEBUG
+ find_library (LIBZMQ_LIBRARY_DEBUG
NAMES ${_zmq_debug_names}
)
- find_library (ZeroMQ_LIBRARY_RELEASE
+ find_library (LIBZMQ_LIBRARY_RELEASE
NAMES ${_zmq_release_names}
)
- if (ZeroMQ_LIBRARY_RELEASE AND ZeroMQ_LIBRARY_DEBUG)
- set(LIBZMQ_LIBRARIES
- debug ${ZeroMQ_LIBRARY_DEBUG}
- optimized ${ZeroMQ_LIBRARY_RELEASE}
- )
- elseif (ZeroMQ_LIBRARY_RELEASE)
- set(LIBZMQ_LIBRARIES ${ZeroMQ_LIBRARY_RELEASE})
- elseif (ZeroMQ_LIBRARY_DEBUG)
- set(LIBZMQ_LIBRARIES ${ZeroMQ_LIBRARY_DEBUG})
- endif ()
+ include(SelectLibraryConfigurations)
+ select_library_configurations(LIBZMQ)
endif ()
if (NOT LIBZMQ_LIBRARIES)
find_library (
LIBZMQ_LIBRARIES
- NAMES zmq libzmq
+ NAMES libzmq zmq
HINTS ${PC_LIBZMQ_LIBRARY_HINTS}
)
endif () Findlibcurl.cmake: diff --git a/Findlibcurl.cmake b/Findlibcurl.cmake
index 4a00c9b7..71014303 100644
--- a/Findlibcurl.cmake
+++ b/Findlibcurl.cmake
@@ -25,7 +25,7 @@ find_path (
find_library (
LIBCURL_LIBRARIES
- NAMES curl
+ NAMES libcurl curl
HINTS ${PC_LIBCURL_LIBRARY_HINTS}
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch also:
Related issue: zeromq/czmq#1972