This is an automated email from the ASF dual-hosted git repository.

isapego pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new af0ef0c4fff IGNITE-27263 C++ Client: Create CMake config file (#7300)
af0ef0c4fff is described below

commit af0ef0c4fff4dc570a10114bdc4e728f95ed2315
Author: Dmitriy Zabotlin <[email protected]>
AuthorDate: Mon Jan 19 18:24:30 2026 +0200

    IGNITE-27263 C++ Client: Create CMake config file (#7300)
    
    Co-authored-by: dzabotlin <[email protected]>
---
 modules/platforms/cpp/CMakeLists.txt               | 39 +++++++++-
 modules/platforms/cpp/cmake/dependencies.cmake     |  2 +-
 .../ignite-config-version.cmake.in}                | 21 +++---
 modules/platforms/cpp/cmake/ignite-config.cmake.in | 66 ++++++++++++++++
 modules/platforms/cpp/ignite/client/CMakeLists.txt | 47 ++++++++----
 .../ignite/client/ignite_client_configuration.h    |  4 +-
 modules/platforms/cpp/ignite/common/CMakeLists.txt |  5 +-
 modules/platforms/cpp/ignite/odbc/CMakeLists.txt   | 42 ++++++++---
 .../cpp/ignite/odbc/config/config_tools_test.cpp   |  2 +-
 .../platforms/cpp/ignite/protocol/CMakeLists.txt   |  2 +-
 modules/platforms/cpp/ignite/tuple/CMakeLists.txt  |  6 --
 .../cpp/{ignite/tuple => pkgconfig}/CMakeLists.txt | 45 +++++------
 .../platforms/cpp/pkgconfig/ignite-client.pc.in    | 11 +++
 modules/platforms/cpp/pkgconfig/ignite-odbc.pc.in  | 11 +++
 .../platforms/cpp/tests/fake_server/CMakeLists.txt |  4 +-
 modules/platforms/cpp/tests/package-test/README.md | 42 +++++++++++
 .../package-test/cmake_package/CMakeLists.txt      | 84 +++++++++++++++++++++
 .../cmake_package_install/CMakeLists.txt           | 88 ++++++++++++++++++++++
 .../package-test/cmake_subdirectory/CMakeLists.txt | 45 +++++++++++
 .../cpp/tests/package-test/test_client.cpp         | 31 ++++++++
 .../platforms/cpp/tests/package-test/test_odbc.cpp | 39 ++++++++++
 21 files changed, 555 insertions(+), 81 deletions(-)

diff --git a/modules/platforms/cpp/CMakeLists.txt 
b/modules/platforms/cpp/CMakeLists.txt
index 64874e2c1ee..49a44e20561 100644
--- a/modules/platforms/cpp/CMakeLists.txt
+++ b/modules/platforms/cpp/CMakeLists.txt
@@ -17,6 +17,8 @@
 
 cmake_minimum_required(VERSION 3.18)
 
+include(CMakePackageConfigHelpers)
+
 file(READ _version.txt IGNITE_VERSION)
 if(NOT DEFINED IGNITE_VERSION)
   set(IGNITE_VERSION 3.0.0)
@@ -48,10 +50,9 @@ list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})
 
 get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
 
+set(IGNITE_CMAKE_TOP_DIR ${CMAKE_CURRENT_LIST_DIR})
+
 include(dependencies)
-if(${INSTALL_IGNITE_FILES})
-    set(CMAKE_INSTALL_PREFIX ${IGNITE_INSTALL_DESTINATION})
-endif()
 
 if(ENABLE_IWYU)
     find_program(IWYU_PATH NAMES include-what-you-use iwyu)
@@ -191,3 +192,35 @@ if (CLANG_FORMAT_BIN)
 else()
     message(STATUS "Failed to find clang-format. So there is no 'format' 
target now.")
 endif()
+
+if (${ENABLE_CLIENT})
+    list(APPEND IGNITE_AVAILABLE_COMPONENTS client)
+endif()
+if (${ENABLE_ODBC})
+    list(APPEND IGNITE_AVAILABLE_COMPONENTS odbc)
+endif()
+
+configure_package_config_file(
+    "cmake/ignite-config.cmake.in"
+    "cmake/ignite-config.cmake"
+    INSTALL_DESTINATION "cmake"
+)
+
+add_subdirectory(pkgconfig)
+
+write_basic_package_version_file(
+    "cmake/ignite-config-version.cmake"
+    VERSION ${PROJECT_VERSION}
+    COMPATIBILITY SameMajorVersion)
+
+install(FILES
+    "${CMAKE_CURRENT_BINARY_DIR}/cmake/ignite-config.cmake"
+    "${CMAKE_CURRENT_BINARY_DIR}/cmake/ignite-config-version.cmake"
+    DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ignite"
+)
+
+# Do not export the package by default
+cmake_policy(SET CMP0090 NEW)
+
+# Make this package visible to the system
+export(PACKAGE ignite)
diff --git a/modules/platforms/cpp/cmake/dependencies.cmake 
b/modules/platforms/cpp/cmake/dependencies.cmake
index 28458efe321..1966568c55a 100644
--- a/modules/platforms/cpp/cmake/dependencies.cmake
+++ b/modules/platforms/cpp/cmake/dependencies.cmake
@@ -22,7 +22,7 @@ set(MBEDTLS_AS_SUBPROJECT ON)
 
 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
 
-add_compile_definitions(TF_PSA_CRYPTO_USER_CONFIG_FILE="${CMAKE_CURRENT_SOURCE_DIR}/ignite/common/detail/ignite_mbedtls_config.h")
+add_compile_definitions(TF_PSA_CRYPTO_USER_CONFIG_FILE="${IGNITE_CMAKE_TOP_DIR}/ignite/common/detail/ignite_mbedtls_config.h")
 
 if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.30.0")
     # Avoid warning about FetchContent_Populate:
diff --git a/modules/platforms/cpp/tests/fake_server/CMakeLists.txt 
b/modules/platforms/cpp/cmake/ignite-config-version.cmake.in
similarity index 67%
copy from modules/platforms/cpp/tests/fake_server/CMakeLists.txt
copy to modules/platforms/cpp/cmake/ignite-config-version.cmake.in
index cff6ddf36cd..bc937c037a4 100644
--- a/modules/platforms/cpp/tests/fake_server/CMakeLists.txt
+++ b/modules/platforms/cpp/cmake/ignite-config-version.cmake.in
@@ -15,15 +15,14 @@
 # limitations under the License.
 #
 
-project(ignite-fake-server)
+set(PACKAGE_VERSION "@PROJECT_VERSION@")
 
-set(TARGET ${PROJECT_NAME})
-
-set(SOURCES
-    main.cpp
-    fake_server.cpp
-    tcp_client_channel.cpp
-        connection_test.cpp
-)
-
-ignite_test(${TARGET} SOURCES ${SOURCES} LIBS ignite-test-common 
ignite3-client)
\ No newline at end of file
+# Check whether the requested PACKAGE_VERSION is compatible
+if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
+    set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+    set(PACKAGE_VERSION_COMPATIBLE TRUE)
+    if("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
+        set(PACKAGE_VERSION_EXACT TRUE)
+    endif()
+endif()
diff --git a/modules/platforms/cpp/cmake/ignite-config.cmake.in 
b/modules/platforms/cpp/cmake/ignite-config.cmake.in
new file mode 100644
index 00000000000..962b572aeca
--- /dev/null
+++ b/modules/platforms/cpp/cmake/ignite-config.cmake.in
@@ -0,0 +1,66 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+@PACKAGE_INIT@
+
+set(ignite_VERSION @PROJECT_VERSION@)
+
+# Available components
+set(ignite_AVAILABLE_COMPONENTS @IGNITE_AVAILABLE_COMPONENTS@)
+
+# Set default component if none specified
+if(NOT ignite_FIND_COMPONENTS)
+    set(ignite_FIND_COMPONENTS client)
+endif()
+
+# Validate requested components
+foreach(_comp ${ignite_FIND_COMPONENTS})
+    if(NOT _comp IN_LIST ignite_AVAILABLE_COMPONENTS)
+        set(ignite_FOUND FALSE)
+        set(ignite_NOT_FOUND_MESSAGE "Requested component '${_comp}' not 
available. Available components: ${ignite_AVAILABLE_COMPONENTS}")
+    endif()
+endforeach()
+
+# Include component-specific target files
+foreach(_comp ${ignite_FIND_COMPONENTS})
+    set(_target_file "${CMAKE_CURRENT_LIST_DIR}/ignite-${_comp}-targets.cmake")
+    set(_target_file_no_install 
"${CMAKE_CURRENT_LIST_DIR}/../ignite/${_comp}/cmake/ignite-${_comp}-targets.cmake")
+    if(EXISTS "${_target_file}")
+        include("${_target_file}")
+        set(ignite_${_comp}_FOUND TRUE)
+    elseif(EXISTS "${_target_file_no_install}")
+        include("${_target_file_no_install}")
+        set(ignite_${_comp}_FOUND TRUE)
+    else()
+        set(ignite_${_comp}_FOUND FALSE)
+        if(ignite_FIND_REQUIRED_${_comp})
+            set(ignite_FOUND FALSE)
+            set(ignite_NOT_FOUND_MESSAGE "Component '${_comp}' not found")
+        endif()
+    endif()
+endforeach()
+
+check_required_components(ignite)
+
+# Set legacy variables for compatibility
+if(ignite_client_FOUND)
+    set(ignite_client_LIBRARIES ignite::client)
+endif()
+
+if(ignite_odbc_FOUND)
+    set(ignite_odbc_LIBRARIES ignite::odbc)
+endif()
diff --git a/modules/platforms/cpp/ignite/client/CMakeLists.txt 
b/modules/platforms/cpp/ignite/client/CMakeLists.txt
index 43a504154e6..12c5eda7a60 100644
--- a/modules/platforms/cpp/ignite/client/CMakeLists.txt
+++ b/modules/platforms/cpp/ignite/client/CMakeLists.txt
@@ -86,14 +86,17 @@ set(PUBLIC_HEADERS
     table/tables.h
     transaction/transaction.h
     transaction/transactions.h
+    transaction/transaction_options.h
 )
 
 add_library(${TARGET}-obj OBJECT ${SOURCES})
-target_include_directories(${TARGET}-obj PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+target_include_directories(${TARGET}-obj PUBLIC ${IGNITE_CMAKE_TOP_DIR})
 
 add_library(${TARGET} SHARED ${SOURCES})
+set_target_properties(${TARGET} PROPERTIES EXPORT_NAME client)
 
 add_library(${TARGET}-static STATIC ${SOURCES})
+set_target_properties(${TARGET}-static PROPERTIES EXPORT_NAME client-static)
 
 set(LIBRARIES
     ignite-common
@@ -109,24 +112,40 @@ foreach(_target_lib IN LISTS _target_libs)
     set_target_properties(${_target_lib} PROPERTIES VERSION 
${CMAKE_PROJECT_VERSION})
     set_target_properties(${_target_lib} PROPERTIES POSITION_INDEPENDENT_CODE 
1)
 
-    if (WIN32)
-        set_target_properties(${_target_lib} PROPERTIES OUTPUT_NAME 
${PROJECT_NAME})
-    endif()
-
-    target_link_libraries(${_target_lib} ${LIBRARIES})
+    target_link_libraries(${_target_lib} PRIVATE ${LIBRARIES})
+    target_include_directories(${_target_lib}
+        PUBLIC $<BUILD_INTERFACE:${IGNITE_CMAKE_TOP_DIR}/>
+               $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/>
+    )
 endforeach()
 unset(_target_libs)
 
+add_library(ignite::client ALIAS ${TARGET})
+add_library(ignite::client-static ALIAS ${TARGET}-static)
 
-if (${INSTALL_IGNITE_FILES})
-    install(TARGETS ${TARGET}
-        RUNTIME DESTINATION bin
-        ARCHIVE DESTINATION lib
-        LIBRARY DESTINATION lib
-    )
+install(TARGETS ${TARGET}
+    EXPORT ignite-client-targets
+    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+    INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+)
+
+export(
+    EXPORT ignite-client-targets
+    NAMESPACE ignite::
+    FILE "cmake/ignite-client-targets.cmake"
+)
+
+install(
+    EXPORT ignite-client-targets
+    NAMESPACE ignite::
+    DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ignite"
+    COMPONENT client
+    FILE "ignite-client-targets.cmake"
+)
 
-    ignite_install_headers(FILES ${PUBLIC_HEADERS} DESTINATION 
${IGNITE_INCLUDEDIR}/client)
-endif()
+ignite_install_headers(FILES ${PUBLIC_HEADERS} DESTINATION 
${IGNITE_INCLUDEDIR}/client)
 
 ignite_test(utils_test DISCOVER SOURCES detail/utils_test.cpp LIBS 
${TARGET}-obj ${LIBRARIES})
 ignite_test(name_utils_test DISCOVER SOURCES detail/table/name_utils_test.cpp 
LIBS ${TARGET}-obj ${LIBRARIES})
diff --git a/modules/platforms/cpp/ignite/client/ignite_client_configuration.h 
b/modules/platforms/cpp/ignite/client/ignite_client_configuration.h
index 57f9e48a6a9..46fd5ed8eae 100644
--- a/modules/platforms/cpp/ignite/client/ignite_client_configuration.h
+++ b/modules/platforms/cpp/ignite/client/ignite_client_configuration.h
@@ -21,14 +21,14 @@
 #include <ignite/client/ignite_logger.h>
 #include <ignite/client/ssl_mode.h>
 
+#include <ignite/common/detail/config.h>
 #include <ignite/common/ignite_error.h>
 
+#include <chrono>
 #include <initializer_list>
 #include <memory>
-#include <chrono>
 #include <string>
 #include <vector>
-#include <detail/config.h>
 
 namespace ignite {
 
diff --git a/modules/platforms/cpp/ignite/common/CMakeLists.txt 
b/modules/platforms/cpp/ignite/common/CMakeLists.txt
index 869e0230d05..821aaa6a70d 100644
--- a/modules/platforms/cpp/ignite/common/CMakeLists.txt
+++ b/modules/platforms/cpp/ignite/common/CMakeLists.txt
@@ -27,6 +27,7 @@ set(PUBLIC_HEADERS
     detail/bits.h
     detail/bytes.h
     detail/config.h
+    detail/byte_traits.h
     detail/mpi.h
     end_point.h
     error_codes.h
@@ -57,9 +58,9 @@ add_library(${TARGET} STATIC ${SOURCES})
 target_link_libraries(${TARGET} PUBLIC TF-PSA-Crypto::tfpsacrypto)
 
 target_include_directories(${TARGET} INTERFACE
-    $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
+    $<BUILD_INTERFACE:${IGNITE_CMAKE_TOP_DIR}>
     $<INSTALL_INTERFACE:${IGNITE_INCLUDEDIR}>
-    PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+    PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>)
 
 if (${INSTALL_IGNITE_FILES})
     ignite_install_headers(FILES ${PUBLIC_HEADERS} DESTINATION 
${IGNITE_INCLUDEDIR}/common)
diff --git a/modules/platforms/cpp/ignite/odbc/CMakeLists.txt 
b/modules/platforms/cpp/ignite/odbc/CMakeLists.txt
index 33526dc2e0f..66db99ff97b 100644
--- a/modules/platforms/cpp/ignite/odbc/CMakeLists.txt
+++ b/modules/platforms/cpp/ignite/odbc/CMakeLists.txt
@@ -56,16 +56,17 @@ set(EXTRA_FILES)
 
 if (WIN32)
     string(REPLACE "." "," CMAKE_PROJECT_VERSION_COMMAS 
${CMAKE_PROJECT_VERSION})
-    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in 
${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY)
+    configure_file(${IGNITE_CMAKE_TOP_DIR}/ignite/odbc/version.rc.in 
${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY)
     set(EXTRA_FILES ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
 endif()
 
 add_compile_definitions(CMAKE_PROJECT_VERSION="${CMAKE_PROJECT_VERSION}")
 
 add_library(${TARGET}-obj OBJECT ${SOURCES})
-target_include_directories(${TARGET}-obj PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} 
${ODBC_INCLUDE_DIRS})
+target_include_directories(${TARGET}-obj PUBLIC ${IGNITE_CMAKE_TOP_DIR} 
${ODBC_INCLUDE_DIRS})
 
 add_library(${TARGET} SHARED $<TARGET_OBJECTS:${TARGET}-obj> module.def 
${EXTRA_FILES})
+set_target_properties(${TARGET} PROPERTIES EXPORT_NAME odbc)
 
 set(LIBRARIES
     ignite-common
@@ -94,19 +95,38 @@ foreach(_target_lib IN LISTS _target_libs)
     endif()
 
     target_include_directories(${_target_lib} SYSTEM INTERFACE 
${ODBC_INCLUDE_DIRS})
-    target_link_libraries(${_target_lib} ${LIBRARIES})
+    target_include_directories(${_target_lib}
+        INTERFACE $<BUILD_INTERFACE:${IGNITE_CMAKE_TOP_DIR}/>
+                  $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/>
+    )
+    target_link_libraries(${_target_lib} PRIVATE ${LIBRARIES})
 endforeach()
 unset(_target_libs)
 
-if (${INSTALL_IGNITE_FILES})
-    install(TARGETS ${TARGET}
-        RUNTIME DESTINATION bin
-        ARCHIVE DESTINATION lib
-        LIBRARY DESTINATION lib
-    )
-endif()
+add_library(ignite::odbc ALIAS ${TARGET})
+
+install(TARGETS ${TARGET}
+    EXPORT ignite-odbc-targets
+    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+    INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+)
+
+export(
+    EXPORT ignite-odbc-targets
+    NAMESPACE ignite::
+    FILE "cmake/ignite-odbc-targets.cmake"
+)
+
+install(
+    EXPORT ignite-odbc-targets
+    NAMESPACE ignite::
+    DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ignite"
+    COMPONENT odbc
+    FILE "ignite-odbc-targets.cmake"
+)
 
 ignite_test(connection_info_test DISCOVER SOURCES 
config/connection_info_test.cpp LIBS ${TARGET}-obj ${LIBRARIES})
 ignite_test(config_tools_test DISCOVER SOURCES config/config_tools_test.cpp 
LIBS ${TARGET}-obj ${LIBRARIES})
 ignite_test(application_data_buffer_test DISCOVER SOURCES 
app/application_data_buffer_test.cpp LIBS ${TARGET}-obj ${LIBRARIES})
-
diff --git a/modules/platforms/cpp/ignite/odbc/config/config_tools_test.cpp 
b/modules/platforms/cpp/ignite/odbc/config/config_tools_test.cpp
index 40dbf915802..86b5681ce6b 100644
--- a/modules/platforms/cpp/ignite/odbc/config/config_tools_test.cpp
+++ b/modules/platforms/cpp/ignite/odbc/config/config_tools_test.cpp
@@ -17,7 +17,7 @@
 
 #include "config_tools.h"
 #include "configuration.h"
-#include "odbc_error.h"
+#include "ignite/odbc/odbc_error.h"
 
 #include <gtest/gtest.h>
 
diff --git a/modules/platforms/cpp/ignite/protocol/CMakeLists.txt 
b/modules/platforms/cpp/ignite/protocol/CMakeLists.txt
index 46318d00c48..a77aefb5c76 100644
--- a/modules/platforms/cpp/ignite/protocol/CMakeLists.txt
+++ b/modules/platforms/cpp/ignite/protocol/CMakeLists.txt
@@ -34,7 +34,7 @@ set(SOURCES
 )
 
 add_library(${TARGET} OBJECT ${SOURCES})
-target_link_libraries(${TARGET} ignite-common msgpack-c)
+target_link_libraries(${TARGET} PUBLIC ignite-common msgpack-c)
 
 set_target_properties(${TARGET} PROPERTIES VERSION ${CMAKE_PROJECT_VERSION})
 set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE 1)
diff --git a/modules/platforms/cpp/ignite/tuple/CMakeLists.txt 
b/modules/platforms/cpp/ignite/tuple/CMakeLists.txt
index ad32f1c386f..b079f1d22a6 100644
--- a/modules/platforms/cpp/ignite/tuple/CMakeLists.txt
+++ b/modules/platforms/cpp/ignite/tuple/CMakeLists.txt
@@ -37,11 +37,5 @@ target_link_libraries(${TARGET} ignite-common)
 ignite_test(tuple_test DISCOVER SOURCES tuple_test.cpp LIBS ${TARGET})
 
 if (${INSTALL_IGNITE_FILES})
-    install(TARGETS ${TARGET}
-        RUNTIME DESTINATION bin
-        ARCHIVE DESTINATION lib
-        LIBRARY DESTINATION lib
-    )
-
     ignite_install_headers(FILES ${PUBLIC_HEADERS} DESTINATION 
${IGNITE_INCLUDEDIR}/tuple)
 endif()
diff --git a/modules/platforms/cpp/ignite/tuple/CMakeLists.txt 
b/modules/platforms/cpp/pkgconfig/CMakeLists.txt
similarity index 55%
copy from modules/platforms/cpp/ignite/tuple/CMakeLists.txt
copy to modules/platforms/cpp/pkgconfig/CMakeLists.txt
index ad32f1c386f..b9975fc0373 100644
--- a/modules/platforms/cpp/ignite/tuple/CMakeLists.txt
+++ b/modules/platforms/cpp/pkgconfig/CMakeLists.txt
@@ -15,33 +15,24 @@
 # limitations under the License.
 #
 
-project(ignite-tuple)
-
-set(TARGET ${PROJECT_NAME})
-
-set(SOURCES
-    binary_tuple_builder.cpp
-    binary_tuple_parser.cpp
-)
-
-set(PUBLIC_HEADERS
-    binary_tuple_builder.h
-    binary_tuple_common.h
-    binary_tuple_parser.h
-)
-
-add_library(${TARGET} STATIC ${SOURCES})
-
-target_link_libraries(${TARGET} ignite-common)
-
-ignite_test(tuple_test DISCOVER SOURCES tuple_test.cpp LIBS ${TARGET})
-
-if (${INSTALL_IGNITE_FILES})
-    install(TARGETS ${TARGET}
-        RUNTIME DESTINATION bin
-        ARCHIVE DESTINATION lib
-        LIBRARY DESTINATION lib
+if (${ENABLE_CLIENT})
+    configure_file(
+            ${CMAKE_CURRENT_SOURCE_DIR}/ignite-client.pc.in
+            ${CMAKE_CURRENT_BINARY_DIR}/ignite-client.pc
+            @ONLY
+    )
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ignite-client.pc
+            DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
     )
+endif()
 
-    ignite_install_headers(FILES ${PUBLIC_HEADERS} DESTINATION 
${IGNITE_INCLUDEDIR}/tuple)
+if (${ENABLE_ODBC})
+    configure_file(
+            ${CMAKE_CURRENT_SOURCE_DIR}/ignite-odbc.pc.in
+            ${CMAKE_CURRENT_BINARY_DIR}/ignite-odbc.pc
+            @ONLY
+    )
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ignite-odbc.pc
+            DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
+    )
 endif()
diff --git a/modules/platforms/cpp/pkgconfig/ignite-client.pc.in 
b/modules/platforms/cpp/pkgconfig/ignite-client.pc.in
new file mode 100644
index 00000000000..957e00fdf54
--- /dev/null
+++ b/modules/platforms/cpp/pkgconfig/ignite-client.pc.in
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
+includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
+
+Name: ignite-client
+Description: Apache Ignite C++ Client Library
+Version: @PROJECT_VERSION@
+Requires:
+Libs: -L${libdir} -lignite-client
+Cflags: -I${includedir}
diff --git a/modules/platforms/cpp/pkgconfig/ignite-odbc.pc.in 
b/modules/platforms/cpp/pkgconfig/ignite-odbc.pc.in
new file mode 100644
index 00000000000..a257365de14
--- /dev/null
+++ b/modules/platforms/cpp/pkgconfig/ignite-odbc.pc.in
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
+includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
+
+Name: ignite-odbc
+Description: Apache Ignite ODBC Driver
+Version: @PROJECT_VERSION@
+Requires:
+Libs: -L${libdir} -lignite-odbc
+Cflags: -I${includedir}
diff --git a/modules/platforms/cpp/tests/fake_server/CMakeLists.txt 
b/modules/platforms/cpp/tests/fake_server/CMakeLists.txt
index cff6ddf36cd..2bb36ff07be 100644
--- a/modules/platforms/cpp/tests/fake_server/CMakeLists.txt
+++ b/modules/platforms/cpp/tests/fake_server/CMakeLists.txt
@@ -23,7 +23,7 @@ set(SOURCES
     main.cpp
     fake_server.cpp
     tcp_client_channel.cpp
-        connection_test.cpp
+    connection_test.cpp
 )
 
-ignite_test(${TARGET} SOURCES ${SOURCES} LIBS ignite-test-common 
ignite3-client)
\ No newline at end of file
+ignite_test(${TARGET} SOURCES ${SOURCES} LIBS ignite-test-common 
ignite3-client msgpack-c)
\ No newline at end of file
diff --git a/modules/platforms/cpp/tests/package-test/README.md 
b/modules/platforms/cpp/tests/package-test/README.md
new file mode 100644
index 00000000000..eae0ccfb989
--- /dev/null
+++ b/modules/platforms/cpp/tests/package-test/README.md
@@ -0,0 +1,42 @@
+# Ignite Package Test
+
+This directory contains tests to verify that the installed Ignite package can 
be found and used correctly via CMake's `find_package()` mechanism.
+
+## Purpose
+
+These tests verify:
+1. The `ignite-config.cmake` package configuration works correctly
+2. Component-based discovery (client, odbc) functions properly
+3. The exported CMake targets link correctly
+4. Headers and libraries are accessible
+
+## Building the Tests
+
+Each test configuration can build two executables: `test_client` and 
`test_odbc`; there are corresponding CMake options:
+ * `ENABLE_CLIENT`
+ * `ENABLE_ODBC`
+These options can be used together. Each CMake configuration should build two 
tests (if `ENABLE_CLIENT=ON` and `ENABLE_ODBC=ON` are specified).
+Successful compilation of these tests means we have found Ignite components, 
include directories and libraries to link with.
+
+### `cmake_package`
+
+This test implies that there is Ignite source code folder and Ignite was built 
at least once, but was not installed. 
+This test uses `ignite-config.cmake` which will be generated in the binary 
directory.
+
+Build command:
+`cmake -DENABLE_CLIENT=ON -DENABLE_ODBC=ON -S 
../tests/package-test/cmake_package/ -B build_package && cmake --build 
build_package`
+
+### `cmake_package_install`
+
+This test will search for the Ignite installation. For test purposes, the 
install will be done in a directory inside the build directory.
+The Test will search for `ignite-config.cmake` in the installation directory. 
+
+Build command:
+`cmake -DENABLE_CLIENT=ON -DENABLE_ODBC=ON -S 
../tests/package-test/cmake_package_install/ -B build_package_install && cmake 
--build build_package_install`
+
+### `cmake_subdirectory`
+
+This test will include Ignite as cmake subdirectory and will build its targets 
to link to the tests.
+
+Build command:
+`cmake -DENABLE_CLIENT=ON -DENABLE_ODBC=ON -S 
../tests/package-test/cmake_subdirectory/ -B build_subdirectory && cmake 
--build build_subdirectory`
diff --git 
a/modules/platforms/cpp/tests/package-test/cmake_package/CMakeLists.txt 
b/modules/platforms/cpp/tests/package-test/cmake_package/CMakeLists.txt
new file mode 100644
index 00000000000..8eeff75b009
--- /dev/null
+++ b/modules/platforms/cpp/tests/package-test/cmake_package/CMakeLists.txt
@@ -0,0 +1,84 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+cmake_minimum_required(VERSION 3.18)
+
+project(ignite_package_test)
+
+set(CMAKE_CXX_STANDARD 17)
+
+option(ENABLE_CLIENT "Build Ignite.C++ Client module" OFF)
+option(ENABLE_ODBC "Build Ignite ODBC driver module" OFF)
+
+set(IGNITE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../")
+set(IGNITE_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/cmake_package")
+
+execute_process(
+    COMMAND "${CMAKE_COMMAND}"
+    "-H${IGNITE_SOURCE_DIR}"
+    "-B${IGNITE_BINARY_DIR}"
+    "-DENABLE_ODBC=${ENABLE_ODBC}"
+    "-DENABLE_CLIENT=${ENABLE_CLIENT}"
+    RESULT_VARIABLE CONFIGURE_RESULT
+    ERROR_VARIABLE CONFIGURE_ERROR
+)
+
+if(NOT CONFIGURE_RESULT EQUAL 0)
+    message(FATAL_ERROR "CMake configure step failed: ${CONFIGURE_ERROR}")
+endif()
+
+execute_process(
+    COMMAND "${CMAKE_COMMAND}"
+        --build "${IGNITE_BINARY_DIR}"
+    RESULT_VARIABLE BUILD_RESULT
+    ERROR_VARIABLE BUILD_ERROR
+)
+
+if(NOT BUILD_RESULT EQUAL 0)
+    message(FATAL_ERROR "CMake build step failed: ${BUILD_ERROR}")
+endif()
+
+set(IGNITE_COMPONENTS "")
+if(ENABLE_CLIENT)
+    list(APPEND IGNITE_COMPONENTS client)
+endif()
+if(ENABLE_ODBC)
+    list(APPEND IGNITE_COMPONENTS odbc)
+endif()
+
+set(ignite_DIR "${IGNITE_BINARY_DIR}/cmake/")
+find_package(ignite REQUIRED COMPONENTS ${IGNITE_COMPONENTS})
+
+if(NOT ignite_FOUND)
+    message(FATAL_ERROR "Ignite is not found!")
+endif()
+
+if(ENABLE_CLIENT)
+    if(NOT ignite_client_FOUND)
+        message(FATAL_ERROR "Ignite client component is not found!")
+    endif()
+    add_executable(test_client ${CMAKE_CURRENT_LIST_DIR}/../test_client.cpp)
+    target_link_libraries(test_client ignite::client)
+endif()
+
+if(ENABLE_ODBC)
+    if(NOT ignite_odbc_FOUND)
+        message(FATAL_ERROR "Ignite odbc component is not found!")
+    endif()
+    add_executable(test_odbc ${CMAKE_CURRENT_LIST_DIR}/../test_odbc.cpp)
+    target_link_libraries(test_odbc ignite::odbc)
+endif()
diff --git 
a/modules/platforms/cpp/tests/package-test/cmake_package_install/CMakeLists.txt 
b/modules/platforms/cpp/tests/package-test/cmake_package_install/CMakeLists.txt
new file mode 100644
index 00000000000..e715fc8a9e1
--- /dev/null
+++ 
b/modules/platforms/cpp/tests/package-test/cmake_package_install/CMakeLists.txt
@@ -0,0 +1,88 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+cmake_minimum_required(VERSION 3.18)
+
+project(ignite_package_install_test)
+
+set(CMAKE_CXX_STANDARD 17)
+
+option(ENABLE_CLIENT "Build Ignite.C++ Client module" OFF)
+option(ENABLE_ODBC "Build Ignite ODBC driver module" OFF)
+
+set(IGNITE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../")
+set(IGNITE_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/cmake_package_install")
+set(IGNITE_BINARY_DIR "${IGNITE_INSTALL_DIR}${CMAKE_FILES_DIRECTORY}")
+
+execute_process(
+    COMMAND "${CMAKE_COMMAND}"
+    "-H${IGNITE_SOURCE_DIR}"
+    "-B${IGNITE_BINARY_DIR}"
+    "-DENABLE_ODBC=${ENABLE_ODBC}"
+    "-DENABLE_CLIENT=${ENABLE_CLIENT}"
+    "-DENABLE_TESTS=OFF"
+    "-DCMAKE_INSTALL_PREFIX=${IGNITE_INSTALL_DIR}"
+    RESULT_VARIABLE CONFIGURE_RESULT
+    ERROR_VARIABLE CONFIGURE_ERROR
+)
+
+if(NOT CONFIGURE_RESULT EQUAL 0)
+    message(FATAL_ERROR "CMake configure step failed: ${CONFIGURE_ERROR}")
+endif()
+
+execute_process(
+    COMMAND "${CMAKE_COMMAND}"
+        --build "${IGNITE_BINARY_DIR}"
+        --target install
+    RESULT_VARIABLE BUILD_RESULT
+    ERROR_VARIABLE BUILD_ERROR
+)
+
+if(NOT BUILD_RESULT EQUAL 0)
+    message(FATAL_ERROR "CMake build step failed: ${BUILD_ERROR}")
+endif()
+
+set(IGNITE_COMPONENTS "")
+if(ENABLE_CLIENT)
+    list(APPEND IGNITE_COMPONENTS client)
+endif()
+if(ENABLE_ODBC)
+    list(APPEND IGNITE_COMPONENTS odbc)
+endif()
+
+list(INSERT CMAKE_PREFIX_PATH 0 "${IGNITE_INSTALL_DIR}")
+find_package(ignite REQUIRED COMPONENTS ${IGNITE_COMPONENTS})
+
+if(NOT ignite_FOUND)
+    message(FATAL_ERROR "Ignite is not found!")
+endif()
+
+if(ENABLE_CLIENT)
+    if(NOT ignite_client_FOUND)
+        message(FATAL_ERROR "Ignite client component is not found!")
+    endif()
+    add_executable(test_client ${CMAKE_CURRENT_LIST_DIR}/../test_client.cpp)
+    target_link_libraries(test_client ignite::client)
+endif()
+
+if(ENABLE_ODBC)
+    if(NOT ignite_odbc_FOUND)
+        message(FATAL_ERROR "Ignite odbc component is not found!")
+    endif()
+    add_executable(test_odbc ${CMAKE_CURRENT_LIST_DIR}/../test_odbc.cpp)
+    target_link_libraries(test_odbc ignite::odbc)
+endif()
diff --git 
a/modules/platforms/cpp/tests/package-test/cmake_subdirectory/CMakeLists.txt 
b/modules/platforms/cpp/tests/package-test/cmake_subdirectory/CMakeLists.txt
new file mode 100644
index 00000000000..c879c90c4d8
--- /dev/null
+++ b/modules/platforms/cpp/tests/package-test/cmake_subdirectory/CMakeLists.txt
@@ -0,0 +1,45 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+cmake_minimum_required(VERSION 3.18)
+
+project(ignite_subdirectory)
+
+set(CMAKE_CXX_STANDARD 17)
+
+option(ENABLE_CLIENT "Build Ignite.C++ Client module" OFF)
+option(ENABLE_ODBC "Build Ignite ODBC driver module" OFF)
+
+set(IGNITE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../)
+
+add_subdirectory(${IGNITE_DIR} build)
+
+if(ENABLE_CLIENT)
+    if(NOT TARGET ignite::client)
+        message(FATAL_ERROR "ignite::client target is not found!")
+    endif()
+    add_executable(test_client ${CMAKE_CURRENT_LIST_DIR}/../test_client.cpp)
+    target_link_libraries(test_client ignite::client)
+endif()
+
+if(ENABLE_ODBC)
+    if(NOT TARGET ignite::odbc)
+        message(FATAL_ERROR "ignite::odbc target is not found!")
+    endif()
+    add_executable(test_odbc ${CMAKE_CURRENT_LIST_DIR}/../test_odbc.cpp)
+    target_link_libraries(test_odbc ignite::odbc)
+endif()
diff --git a/modules/platforms/cpp/tests/package-test/test_client.cpp 
b/modules/platforms/cpp/tests/package-test/test_client.cpp
new file mode 100644
index 00000000000..8251074facc
--- /dev/null
+++ b/modules/platforms/cpp/tests/package-test/test_client.cpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <ignite/client/ignite_client.h>
+#include <ignite/client/ignite_client_configuration.h>
+
+#include <iostream>
+
+int main() {
+    std::cout << "Testing Ignite client library linkage..." << std::endl;
+
+    // Test basic configuration creation
+    ignite::ignite_client_configuration cfg{"127.0.0.1:10800"};
+
+    std::cout << "Client library test: OK" << std::endl;
+    return 0;
+}
diff --git a/modules/platforms/cpp/tests/package-test/test_odbc.cpp 
b/modules/platforms/cpp/tests/package-test/test_odbc.cpp
new file mode 100644
index 00000000000..59303f8d342
--- /dev/null
+++ b/modules/platforms/cpp/tests/package-test/test_odbc.cpp
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifdef WIN32
+# include <windows.h>
+#endif
+
+#include <sql.h>
+#include <sqlext.h>
+
+#include <iostream>
+
+int main() {
+    std::cout << "Testing Ignite ODBC library linkage..." << std::endl;
+
+    SQLHENV env = nullptr;
+    SQLRETURN ret = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
+
+    if (env) {
+        SQLFreeHandle(SQL_HANDLE_ENV, env);
+    }
+
+    std::cout << "ODBC library test: OK (return code: " << ret << ")" << 
std::endl;
+    return 0;
+}


Reply via email to