From 7ec37add5c35ca110e2b97ba0e34db1d400fdaaf Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Sat, 9 Oct 2021 13:35:24 +0800 Subject: [PATCH] supress CMP0048 warning --- CMakeLists.txt | 4 ++-- cmake/EnableCMP0048.txt.in | 1 + deps/CMakeLists.txt | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 cmake/EnableCMP0048.txt.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 190b693321..65d1e133d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,13 +36,13 @@ cat("${CMAKE_SUPPORT_DIR}/zlib_CMakeLists.txt.in" ${DEPS_TMP_FILE}) cat("${CMAKE_SUPPORT_DIR}/cjson_CMakeLists.txt.in" ${DEPS_TMP_FILE}) ## leveldb -option(BUILD_WITH_LEVELDB "If build with leveldb" ON) +option(BUILD_WITH_LEVELDB "If build with leveldb" OFF) if(${BUILD_WITH_LEVELDB}) cat("${CMAKE_SUPPORT_DIR}/leveldb_CMakeLists.txt.in" ${DEPS_TMP_FILE}) endif(${BUILD_WITH_LEVELDB}) ## rocksdb -option(BUILD_WITH_ROCKSDB "If build with rocksdb" ON) +option(BUILD_WITH_ROCKSDB "If build with rocksdb" OFF) if(${BUILD_WITH_ROCKSDB}) cat("${CMAKE_SUPPORT_DIR}/rocksdb_CMakeLists.txt.in" ${DEPS_TMP_FILE}) endif(${BUILD_WITH_ROCKSDB}) diff --git a/cmake/EnableCMP0048.txt.in b/cmake/EnableCMP0048.txt.in new file mode 100644 index 0000000000..1b59188fd7 --- /dev/null +++ b/cmake/EnableCMP0048.txt.in @@ -0,0 +1 @@ +cmake_policy(SET CMP0048 NEW) \ No newline at end of file diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index a872de5fb8..50225da82b 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -4,12 +4,15 @@ if(${BUILD_TEST}) endif(${BUILD_TEST}) # cJson +# see https://stackoverflow.com/questions/37582508/silence-cmp0048-warnings-in-vendored-projects +set(CMAKE_PROJECT_INCLUDE_BEFORE "${CMAKE_SUPPORT_DIR}/EnableCMP0048.txt.in") add_subdirectory(cJson) target_include_directories( cjson # see https://stackoverflow.com/questions/25676277/cmake-target-include-directories-prints-an-error-when-i-try-to-add-the-source PUBLIC $ ) +unset(CMAKE_PROJECT_INCLUDE_BEFORE) # lz4 add_subdirectory(lz4/build/cmake) @@ -19,12 +22,14 @@ target_include_directories( ) # zlib +set(CMAKE_PROJECT_INCLUDE_BEFORE "${CMAKE_SUPPORT_DIR}/EnableCMP0048.txt.in") add_subdirectory(zlib) target_include_directories( zlib PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/zlib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/zlib ) +unset(CMAKE_PROJECT_INCLUDE_BEFORE) # leveldb if(${BUILD_WITH_LEVELDB})