From df72805aafa1174daf4dd8ac7427c901beb2a8af Mon Sep 17 00:00:00 2001 From: Lucian Petrut Date: Fri, 15 Nov 2019 14:41:56 +0000 Subject: [PATCH] cmake: Set missing dependencies When building Windows DLLs, all symbols must be resolved. For this reason, we'll have to make sure that we don't have any unresolved symbols. We ended up having some issues with multiple definitions when doing this for Linux targets, so we'll do this only for Windows buids for now: http://paste.openstack.org/raw/787049/ We'll avoid having the librbd plugins as a librbd dependency since this introduces a circular dependency. Signed-off-by: Lucian Petrut Signed-off-by: Alin Gabriel Serdean --- src/compressor/lz4/CMakeLists.txt | 3 ++- src/compressor/snappy/CMakeLists.txt | 3 ++- src/compressor/zlib/CMakeLists.txt | 2 +- src/compressor/zstd/CMakeLists.txt | 2 +- src/crypto/openssl/CMakeLists.txt | 4 +++- src/erasure-code/CMakeLists.txt | 3 ++- src/librbd/CMakeLists.txt | 5 ++--- 7 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/compressor/lz4/CMakeLists.txt b/src/compressor/lz4/CMakeLists.txt index 2341ce5aef79..ff8e14c298c7 100644 --- a/src/compressor/lz4/CMakeLists.txt +++ b/src/compressor/lz4/CMakeLists.txt @@ -5,7 +5,8 @@ set(lz4_sources ) add_library(ceph_lz4 SHARED ${lz4_sources}) -target_link_libraries(ceph_lz4 PRIVATE LZ4::LZ4 compressor) +target_link_libraries(ceph_lz4 + PRIVATE LZ4::LZ4 compressor $<$:ceph-common>) set_target_properties(ceph_lz4 PROPERTIES VERSION 2.0.0 SOVERSION 2 diff --git a/src/compressor/snappy/CMakeLists.txt b/src/compressor/snappy/CMakeLists.txt index 5396e03f1ead..d1ba3b2e7466 100644 --- a/src/compressor/snappy/CMakeLists.txt +++ b/src/compressor/snappy/CMakeLists.txt @@ -5,7 +5,8 @@ set(snappy_sources ) add_library(ceph_snappy SHARED ${snappy_sources}) -target_link_libraries(ceph_snappy PRIVATE snappy::snappy compressor) +target_link_libraries(ceph_snappy + PRIVATE snappy::snappy compressor $<$:ceph-common>) set_target_properties(ceph_snappy PROPERTIES VERSION 2.0.0 SOVERSION 2 diff --git a/src/compressor/zlib/CMakeLists.txt b/src/compressor/zlib/CMakeLists.txt index c357c3266600..c1c8413949c8 100644 --- a/src/compressor/zlib/CMakeLists.txt +++ b/src/compressor/zlib/CMakeLists.txt @@ -49,7 +49,7 @@ else(HAVE_INTEL_SSE4_1 AND HAVE_BETTER_YASM_ELF64 AND (NOT APPLE)) endif(HAVE_INTEL_SSE4_1 AND HAVE_BETTER_YASM_ELF64 AND (NOT APPLE)) add_library(ceph_zlib SHARED ${zlib_sources}) -target_link_libraries(ceph_zlib ZLIB::ZLIB compressor) +target_link_libraries(ceph_zlib ZLIB::ZLIB compressor $<$:ceph-common>) target_include_directories(ceph_zlib SYSTEM PRIVATE "${CMAKE_SOURCE_DIR}/src/isa-l/include") set_target_properties(ceph_zlib PROPERTIES VERSION 2.0.0 diff --git a/src/compressor/zstd/CMakeLists.txt b/src/compressor/zstd/CMakeLists.txt index a5ebdaf53810..b53b0d944482 100644 --- a/src/compressor/zstd/CMakeLists.txt +++ b/src/compressor/zstd/CMakeLists.txt @@ -28,7 +28,7 @@ set(zstd_sources ) add_library(ceph_zstd SHARED ${zstd_sources}) -target_link_libraries(ceph_zstd PRIVATE zstd) +target_link_libraries(ceph_zstd PRIVATE zstd $<$:ceph-common>) set_target_properties(ceph_zstd PROPERTIES VERSION 2.0.0 SOVERSION 2 diff --git a/src/crypto/openssl/CMakeLists.txt b/src/crypto/openssl/CMakeLists.txt index 7a63a32e8b3b..6ede1567f218 100644 --- a/src/crypto/openssl/CMakeLists.txt +++ b/src/crypto/openssl/CMakeLists.txt @@ -5,7 +5,9 @@ set(openssl_crypto_plugin_srcs openssl_crypto_plugin.cc) add_library(ceph_crypto_openssl SHARED ${openssl_crypto_plugin_srcs}) -target_link_libraries(ceph_crypto_openssl PRIVATE crypto) +target_link_libraries(ceph_crypto_openssl + PRIVATE OpenSSL::Crypto + $<$:ceph-common>) target_include_directories(ceph_crypto_openssl PRIVATE ${OPENSSL_INCLUDE_DIR}) add_dependencies(crypto_plugins ceph_crypto_openssl) set_target_properties(ceph_crypto_openssl PROPERTIES INSTALL_RPATH "") diff --git a/src/erasure-code/CMakeLists.txt b/src/erasure-code/CMakeLists.txt index 9cdc62e7dcbd..59e778159489 100644 --- a/src/erasure-code/CMakeLists.txt +++ b/src/erasure-code/CMakeLists.txt @@ -28,7 +28,8 @@ if(HAVE_BETTER_YASM_ELF64 OR HAVE_ARMV8_SIMD) endif() add_library(erasure_code STATIC ErasureCodePlugin.cc) -target_link_libraries(erasure_code ${CMAKE_DL_LIBS}) +target_link_libraries(erasure_code $<$:dlfcn_win32> + ${CMAKE_DL_LIBS}) add_library(erasure_code_objs OBJECT ErasureCode.cc) diff --git a/src/librbd/CMakeLists.txt b/src/librbd/CMakeLists.txt index 039504003759..b73fa25b7622 100644 --- a/src/librbd/CMakeLists.txt +++ b/src/librbd/CMakeLists.txt @@ -206,7 +206,7 @@ if(WITH_EVENTTRACE) add_dependencies(rbd_internal eventtrace_tp) endif() target_link_libraries(rbd_internal PRIVATE - osdc) + osdc rbd_types) if(WITH_RBD_RWL) target_link_libraries(rbd_internal @@ -222,7 +222,7 @@ set(rbd_plugin_parent_cache_srcs add_library(librbd_plugin_parent_cache SHARED ${rbd_plugin_parent_cache_srcs}) target_link_libraries(librbd_plugin_parent_cache PRIVATE - ceph_immutable_object_cache_lib + ceph_immutable_object_cache_lib ceph-common librbd librados) set_target_properties(librbd_plugin_parent_cache PROPERTIES OUTPUT_NAME ceph_librbd_parent_cache @@ -236,7 +236,6 @@ add_library(librbd ${CEPH_SHARED} if(WITH_LTTNG) add_dependencies(librbd librbd-tp) endif() -add_dependencies(librbd librbd_plugins) target_link_libraries(librbd PRIVATE rbd_internal -- 2.47.3