diff --git a/cpp/cmake_modules/BuildUtils.cmake b/cpp/cmake_modules/BuildUtils.cmake index 250aadeb33174..479b20b7a05fc 100644 --- a/cpp/cmake_modules/BuildUtils.cmake +++ b/cpp/cmake_modules/BuildUtils.cmake @@ -189,6 +189,7 @@ function(ADD_ARROW_LIB LIB_NAME) EXTRA_INCLUDES PRIVATE_INCLUDES DEPENDENCIES + DEFINITIONS SHARED_INSTALL_INTERFACE_LIBS STATIC_INSTALL_INTERFACE_LIBS OUTPUT_PATH) @@ -247,6 +248,9 @@ function(ADD_ARROW_LIB LIB_NAME) if(ARG_DEPENDENCIES) add_dependencies(${LIB_NAME}_objlib ${ARG_DEPENDENCIES}) endif() + if(ARG_DEFINITIONS) + target_compile_definitions(${LIB_NAME}_objlib PRIVATE ${ARG_DEFINITIONS}) + endif() if(ARG_PRECOMPILED_HEADER_LIB) reuse_precompiled_header_lib(${LIB_NAME}_objlib ${ARG_PRECOMPILED_HEADER_LIB}) endif() @@ -297,6 +301,10 @@ function(ADD_ARROW_LIB LIB_NAME) add_dependencies(${LIB_NAME}_shared ${EXTRA_DEPS}) endif() + if(ARG_DEFINITIONS) + target_compile_definitions(${LIB_NAME}_shared PRIVATE ${ARG_DEFINITIONS}) + endif() + if(ARG_PRECOMPILED_HEADER_LIB) reuse_precompiled_header_lib(${LIB_NAME}_shared ${ARG_PRECOMPILED_HEADER_LIB}) endif() @@ -387,6 +395,10 @@ function(ADD_ARROW_LIB LIB_NAME) add_dependencies(${LIB_NAME}_static ${EXTRA_DEPS}) endif() + if(ARG_DEFINITIONS) + target_compile_definitions(${LIB_NAME}_static PRIVATE ${ARG_DEFINITIONS}) + endif() + if(ARG_PRECOMPILED_HEADER_LIB) reuse_precompiled_header_lib(${LIB_NAME}_static ${ARG_PRECOMPILED_HEADER_LIB}) endif() @@ -632,7 +644,8 @@ function(ADD_TEST_CASE REL_TEST_NAME) LABELS EXTRA_LABELS TEST_ARGUMENTS - PREFIX) + PREFIX + DEFINITIONS) cmake_parse_arguments(ARG "${options}" "${one_value_args}" @@ -703,6 +716,10 @@ function(ADD_TEST_CASE REL_TEST_NAME) add_dependencies(${TEST_NAME} ${ARG_EXTRA_DEPENDENCIES}) endif() + if(ARG_DEFINITIONS) + target_compile_definitions(${TEST_NAME} PRIVATE ${ARG_DEFINITIONS}) + endif() + if(ARROW_TEST_MEMCHECK AND NOT ARG_NO_VALGRIND) add_test(${TEST_NAME} bash diff --git a/cpp/src/plasma/CMakeLists.txt b/cpp/src/plasma/CMakeLists.txt index 7f05d5bcdc6d3..68f1c5ffa9156 100644 --- a/cpp/src/plasma/CMakeLists.txt +++ b/cpp/src/plasma/CMakeLists.txt @@ -83,6 +83,9 @@ add_arrow_lib(plasma plasma SOURCES ${PLASMA_SRCS} + DEFINITIONS + "ARROW_EXPORTING" + "_PLASMA_NO_DEPRECATE" OUTPUTS PLASMA_LIBRARIES SHARED_LINK_FLAGS @@ -98,10 +101,6 @@ add_arrow_lib(plasma add_dependencies(plasma ${PLASMA_LIBRARIES}) -foreach(LIB_TARGET ${PLASMA_LIBRARIES}) - target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_EXPORTING) -endforeach() - # The optimization flag -O3 is suggested by dlmalloc.c, which is #included in # malloc.cc; we set it here regardless of whether we do a debug or release build. set_source_files_properties(dlmalloc.cc PROPERTIES COMPILE_FLAGS "-O3") @@ -134,6 +133,7 @@ else() target_link_libraries(plasma-store-server plasma_shared ${PLASMA_LINK_LIBS}) endif() target_link_libraries(plasma-store-server ${GFLAGS_LIBRARIES}) +target_compile_definitions(plasma-store-server PRIVATE _PLASMA_NO_DEPRECATE) add_dependencies(plasma plasma-store-server) if(ARROW_RPATH_ORIGIN) @@ -190,6 +190,8 @@ function(ADD_PLASMA_TEST REL_TEST_NAME) "plasma" LABELS "plasma-tests" + DEFINITIONS + _PLASMA_NO_DEPRECATE ${ARG_UNPARSED_ARGUMENTS}) endfunction() diff --git a/cpp/src/plasma/common.h b/cpp/src/plasma/common.h index d3193bf5c6e2e..e09737ceccdb7 100644 --- a/cpp/src/plasma/common.h +++ b/cpp/src/plasma/common.h @@ -36,7 +36,9 @@ #include "arrow/gpu/cuda_api.h" #endif +#ifndef _PLASMA_NO_DEPRECATE #warning "Plasma is deprecated since Arrow 10.0.0. It will be removed in 12.0.0 or so." +#endif namespace plasma {