From: Kefu Chai Date: Thu, 26 Apr 2018 08:44:07 +0000 (+0800) Subject: cmake: enable CMP0046 X-Git-Tag: v13.1.0~73^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=4aea3bed7f7dc587b19700d516ece68b516f07f3;p=ceph.git cmake: enable CMP0046 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 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d7a699698048..a037c51026845 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/cmake/modules/AddCephTest.cmake b/cmake/modules/AddCephTest.cmake index d250b1ff95254..3cc5faaaa16f8 100644 --- a/cmake/modules/AddCephTest.cmake +++ b/cmake/modules/AddCephTest.cmake @@ -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 diff --git a/src/compressor/brotli/CMakeLists.txt b/src/compressor/brotli/CMakeLists.txt index dc9a90acf5490..70be478044e8a 100644 --- a/src/compressor/brotli/CMakeLists.txt +++ b/src/compressor/brotli/CMakeLists.txt @@ -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}) diff --git a/src/compressor/lz4/CMakeLists.txt b/src/compressor/lz4/CMakeLists.txt index 7a53000e9f742..921b4c573e23e 100644 --- a/src/compressor/lz4/CMakeLists.txt +++ b/src/compressor/lz4/CMakeLists.txt @@ -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 diff --git a/src/compressor/snappy/CMakeLists.txt b/src/compressor/snappy/CMakeLists.txt index ff22462e373cb..139f62af5ddcb 100644 --- a/src/compressor/snappy/CMakeLists.txt +++ b/src/compressor/snappy/CMakeLists.txt @@ -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}) diff --git a/src/compressor/zlib/CMakeLists.txt b/src/compressor/zlib/CMakeLists.txt index 4f130906103a3..231129b872e0a 100644 --- a/src/compressor/zlib/CMakeLists.txt +++ b/src/compressor/zlib/CMakeLists.txt @@ -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 diff --git a/src/compressor/zstd/CMakeLists.txt b/src/compressor/zstd/CMakeLists.txt index a6aaa738a9c2d..5a80aa539c8ef 100644 --- a/src/compressor/zstd/CMakeLists.txt +++ b/src/compressor/zstd/CMakeLists.txt @@ -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 diff --git a/src/crypto/isa-l/CMakeLists.txt b/src/crypto/isa-l/CMakeLists.txt index 49a01870b301b..51b36989132e8 100644 --- a/src/crypto/isa-l/CMakeLists.txt +++ b/src/crypto/isa-l/CMakeLists.txt @@ -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}) diff --git a/src/erasure-code/CMakeLists.txt b/src/erasure-code/CMakeLists.txt index 143057973b48c..0ee74bb47f7b3 100644 --- a/src/erasure-code/CMakeLists.txt +++ b/src/erasure-code/CMakeLists.txt @@ -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) diff --git a/src/erasure-code/isa/CMakeLists.txt b/src/erasure-code/isa/CMakeLists.txt index e0a511e0a8e42..808d6a3ea511e 100644 --- a/src/erasure-code/isa/CMakeLists.txt +++ b/src/erasure-code/isa/CMakeLists.txt @@ -61,7 +61,6 @@ set(isa_srcs add_library(ec_isa SHARED ${isa_srcs} $) -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 "") diff --git a/src/erasure-code/jerasure/CMakeLists.txt b/src/erasure-code/jerasure/CMakeLists.txt index 7f752806cda7f..6da2040479977 100644 --- a/src/erasure-code/jerasure/CMakeLists.txt +++ b/src/erasure-code/jerasure/CMakeLists.txt @@ -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) diff --git a/src/erasure-code/lrc/CMakeLists.txt b/src/erasure-code/lrc/CMakeLists.txt index c25fc695f2fa2..2afdfad5aafae 100644 --- a/src/erasure-code/lrc/CMakeLists.txt +++ b/src/erasure-code/lrc/CMakeLists.txt @@ -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) diff --git a/src/erasure-code/shec/CMakeLists.txt b/src/erasure-code/shec/CMakeLists.txt index d5f8e15ada4a6..fd0f3be6efd6d 100644 --- a/src/erasure-code/shec/CMakeLists.txt +++ b/src/erasure-code/shec/CMakeLists.txt @@ -10,7 +10,6 @@ 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 $ @@ -18,7 +17,6 @@ set(ec_shec_objs $) 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}) diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index cbbb158335d2a..e55f0dd4074f2 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -525,7 +525,6 @@ install(TARGETS add_dependencies(tests ceph-mon ceph-mgr - ceph ceph-authtool get_command_descriptions crushtool diff --git a/src/test/erasure-code/CMakeLists.txt b/src/test/erasure-code/CMakeLists.txt index 7c1de92225b15..4ba31ab2a80bf 100644 --- a/src/test/erasure-code/CMakeLists.txt +++ b/src/test/erasure-code/CMakeLists.txt @@ -17,27 +17,21 @@ install(TARGETS ceph_erasure_code add_library(ec_example SHARED ErasureCodePluginExample.cc $) -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