set(DEBIAN_INSTALL_FILE "${CMAKE_BINARY_DIR}/mariadb-plugin-columnstore.install.generated") file(WRITE ${DEBIAN_INSTALL_FILE} "#File is generated by ColumnstoreLibrary.cmake, do not edit\n") macro(add_to_debian_install_file file_path) string(SUBSTRING "${file_path}" 1 -1 BINARY_ENTRY) file(RELATIVE_PATH CMAKEFILE "${CMAKE_SOURCE_DIR}/storage/columnstore/columnstore" ${CMAKE_CURRENT_LIST_FILE}) string(STRIP "${BINARY_ENTRY}" BINARY_ENTRY) file(APPEND ${DEBIAN_INSTALL_FILE} "${BINARY_ENTRY} # added in ${CMAKEFILE}\n") endmacro() function(get_target_output_filename TARGET_NAME OUTPUT_VAR) # 1. Get the target's OUTPUT_NAME (falls back to TARGET_NAME) get_target_property(OUTPUT_NAME ${TARGET_NAME} OUTPUT_NAME) if(NOT OUTPUT_NAME) set(OUTPUT_NAME "${TARGET_NAME}") endif() # 1. Get the correct suffix based on target type get_target_property(TARGET_TYPE ${TARGET_NAME} TYPE) if(TARGET_TYPE STREQUAL "EXECUTABLE") set(SUFFIX "${CMAKE_EXECUTABLE_SUFFIX}") set(PREFIX "") # No prefix for executables elseif(TARGET_TYPE STREQUAL "SHARED_LIBRARY") set(SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}") set(PREFIX "lib") elseif(TARGET_TYPE STREQUAL "STATIC_LIBRARY") set(SUFFIX "${CMAKE_STATIC_LIBRARY_SUFFIX}") set(PREFIX "lib") else() message(WARNING "Unknown target type for ${TARGET_NAME}") set(SUFFIX "") endif() # 1. Combine into the final filename set(${OUTPUT_VAR} "${PREFIX}${OUTPUT_NAME}${SUFFIX}" PARENT_SCOPE ) endfunction() macro(columnstore_install_target target destination) install( TARGETS ${target} DESTINATION ${destination} COMPONENT columnstore-engine ) get_target_output_filename(${target} OUTPUT_FILENAME) add_to_debian_install_file("${destination}/${OUTPUT_FILENAME}") endmacro() macro(columnstore_install_file file destination) install( FILES ${file} DESTINATION ${destination} COMPONENT columnstore-engine ) get_filename_component(FILENAME ${file} NAME) add_to_debian_install_file("${destination}/${FILENAME}") endmacro() macro(columnstore_install_program file destination) install( PROGRAMS ${file} DESTINATION ${destination} COMPONENT columnstore-engine ) get_filename_component(FILENAME ${file} NAME) add_to_debian_install_file( "${destination}/${FILENAME} " ) endmacro() macro(columnstore_static_library libname) add_definitions(-fPIC -DPIC) add_library(${libname} STATIC ${ARGN}) endmacro() macro(columnstore_shared_library libname) add_library(${libname} SHARED ${ARGN}) columnstore_install_target(${libname} ${ENGINE_LIBDIR}) endmacro() macro(columnstore_library libname) if(COLUMNSTORE_STATIC_LIBRARIES) columnstore_static_library(${libname} ${ARGN}) else() columnstore_shared_library(${libname} ${ARGN}) endif() endmacro() macro(columnstore_mysql_plugin_library libname) add_library(${libname} SHARED ${ARGN}) columnstore_install_target(${libname} ${MARIADB_PLUGINDIR}) endmacro() macro(columnstore_link libname) target_link_libraries(${libname} ${ARGN}) endmacro() macro(columnstore_executable executable_name) add_executable(${executable_name} ${ARGN}) columnstore_install_target(${executable_name} ${ENGINE_BINDIR}) endmacro()