Skip to content

Commit

Permalink
cmake: enable CMP0046
Browse files Browse the repository at this point in the history
so cmake will error on "non-existent dependency in add_dependencies", we
add dependency on CONFIGURE_FILE() output, which is wrong, as its output
is not a target, and is generated when cmake runs. so remove them from
dependencies.

regarding to ceph_ver.h, its path is also wrong. it is created under
${CMAKE_BINARY_DIR}/src/include. so this is another reason to remove it.

Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov committed Apr 26, 2018
1 parent 8e31e6d commit 4aea3be
Show file tree
Hide file tree
Showing 15 changed files with 4 additions and 22 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ if(POLICY CMP0028)
cmake_policy(SET CMP0028 NEW)
endif()
if(POLICY CMP0046)
# Tweak policies (this one disables "missing" dependency warning)
cmake_policy(SET CMP0046 OLD)
cmake_policy(SET CMP0046 NEW)
endif()
if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
Expand Down
4 changes: 3 additions & 1 deletion cmake/modules/AddCephTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
#adds makes target/script into a test, test to check target, sets necessary environment variables
function(add_ceph_test test_name test_path)
add_test(NAME ${test_name} COMMAND ${test_path} ${ARGN})
add_dependencies(tests ${test_name})
if(TARGET ${test_name})
add_dependencies(tests ${test_name})
endif()
set_property(TEST
${test_name}
PROPERTY ENVIRONMENT
Expand Down
1 change: 0 additions & 1 deletion src/compressor/brotli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ foreach(lib ${bortli_libs})
endforeach()

add_library(ceph_brotli SHARED ${brotli_sources})
add_dependencies(ceph_brotli ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
target_include_directories(ceph_brotli PRIVATE "${CMAKE_BINARY_DIR}/src/brotli/c/include")
List(REVERSE bortli_libs)
target_link_libraries(ceph_brotli ${BROTLI_LIBRARIES})
Expand Down
1 change: 0 additions & 1 deletion src/compressor/lz4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ set(lz4_sources
)

add_library(ceph_lz4 SHARED ${lz4_sources})
add_dependencies(ceph_lz4 ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
target_link_libraries(ceph_lz4 ${LZ4_LIBRARY})
set_target_properties(ceph_lz4 PROPERTIES
VERSION 2.0.0
Expand Down
1 change: 0 additions & 1 deletion src/compressor/snappy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ set(snappy_sources
)

add_library(ceph_snappy SHARED ${snappy_sources})
add_dependencies(ceph_snappy ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
target_include_directories(ceph_snappy SYSTEM PRIVATE
"${SNAPPY_INCLUDE_DIR}")
target_link_libraries(ceph_snappy ${SNAPPY_LIBRARIES})
Expand Down
1 change: 0 additions & 1 deletion src/compressor/zlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ 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})
add_dependencies(ceph_zlib ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
target_link_libraries(ceph_zlib ${ZLIB_LIBRARIES})
target_include_directories(ceph_zlib SYSTEM PRIVATE "${CMAKE_SOURCE_DIR}/src/isa-l/include")
set_target_properties(ceph_zlib PROPERTIES
Expand Down
1 change: 0 additions & 1 deletion src/compressor/zstd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ set(zstd_sources
)

add_library(ceph_zstd SHARED ${zstd_sources})
add_dependencies(ceph_zstd ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
target_link_libraries(ceph_zstd zstd)
set_target_properties(ceph_zstd PROPERTIES
VERSION 2.0.0
Expand Down
1 change: 0 additions & 1 deletion src/crypto/isa-l/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,5 @@ endif(HAVE_GOOD_YASM_ELF64)

add_library(ceph_crypto_isal SHARED ${isal_crypto_plugin_srcs})
target_include_directories(ceph_crypto_isal PRIVATE ${isal_dir}/include)
add_dependencies(ceph_crypto_isal ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
set_target_properties(ceph_crypto_isal PROPERTIES VERSION 1.0.0 SOVERSION 1)
install(TARGETS ceph_crypto_isal DESTINATION ${isal_crypto_plugin_dir})
1 change: 0 additions & 1 deletion src/erasure-code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ endif (HAVE_BETTER_YASM_ELF64)

add_library(erasure_code STATIC ErasureCodePlugin.cc)
target_link_libraries(erasure_code ${CMAKE_DL_LIBS})
add_dependencies(erasure_code ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)

add_library(erasure_code_objs OBJECT ErasureCode.cc)

Expand Down
1 change: 0 additions & 1 deletion src/erasure-code/isa/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ set(isa_srcs
add_library(ec_isa SHARED
${isa_srcs}
$<TARGET_OBJECTS:erasure_code_objs>)
add_dependencies(ec_isa ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
target_link_libraries(ec_isa ${EXTRALIBS})
set_target_properties(ec_isa PROPERTIES
INSTALL_RPATH "")
Expand Down
1 change: 0 additions & 1 deletion src/erasure-code/jerasure/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ set(jerasure_utils_src
ErasureCodeJerasure.cc)

add_library(jerasure_utils OBJECT ${jerasure_utils_src})
add_dependencies(jerasure_utils ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)

# Set the CFLAGS correctly for gf-complete based on SIMD compiler support
set(GF_COMPILE_FLAGS)
Expand Down
1 change: 0 additions & 1 deletion src/erasure-code/lrc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ set(lrc_srcs
)

add_library(ec_lrc SHARED ${lrc_srcs})
add_dependencies(ec_lrc ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
set_target_properties(ec_lrc PROPERTIES
INSTALL_RPATH "")
target_link_libraries(ec_lrc json_spirit)
Expand Down
2 changes: 0 additions & 2 deletions src/erasure-code/shec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ set(shec_utils_srcs
determinant.c)

add_library(shec_utils OBJECT ${shec_utils_srcs})
add_dependencies(shec_utils ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)

set(ec_shec_objs
$<TARGET_OBJECTS:gf-complete_objs>
$<TARGET_OBJECTS:jerasure_objs>
$<TARGET_OBJECTS:shec_utils>)

add_library(ec_shec SHARED ${ec_shec_objs})
add_dependencies(ec_shec ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
set_target_properties(ec_shec PROPERTIES
INSTALL_RPATH "")
target_link_libraries(ec_shec ${EXTRALIBS})
Expand Down
1 change: 0 additions & 1 deletion src/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,6 @@ install(TARGETS
add_dependencies(tests
ceph-mon
ceph-mgr
ceph
ceph-authtool
get_command_descriptions
crushtool
Expand Down
6 changes: 0 additions & 6 deletions src/test/erasure-code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,21 @@ install(TARGETS ceph_erasure_code
add_library(ec_example SHARED
ErasureCodePluginExample.cc
$<TARGET_OBJECTS:erasure_code_objs>)
add_dependencies(ec_example ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
target_link_libraries(ec_example pthread ${EXTRALIBS})

add_library(ec_missing_entry_point SHARED ErasureCodePluginMissingEntryPoint.cc)
add_dependencies(ec_missing_entry_point ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
target_link_libraries(ec_missing_entry_point pthread ${EXTRALIBS})

add_library(ec_missing_version SHARED ErasureCodePluginMissingVersion.cc)
add_dependencies(ec_missing_version ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
target_link_libraries(ec_missing_version pthread ${EXTRALIBS})

add_library(ec_hangs SHARED ErasureCodePluginHangs.cc)
add_dependencies(ec_hangs ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
target_link_libraries(ec_hangs pthread ${EXTRALIBS})

add_library(ec_fail_to_initialize SHARED ErasureCodePluginFailToInitialize.cc)
add_dependencies(ec_fail_to_initialize ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
target_link_libraries(ec_fail_to_initialize pthread ${EXTRALIBS})

add_library(ec_fail_to_register SHARED ErasureCodePluginFailToRegister.cc)
add_dependencies(ec_fail_to_register ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
target_link_libraries(ec_fail_to_register pthread ${EXTRALIBS})

# unittest_erasure_code_plugin
Expand Down

0 comments on commit 4aea3be

Please sign in to comment.