mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 10:13:51 +01:00
36c808230c
* fix(ODBC): Poco:Data::ODBC - MSSQL (n)varchar(max) length issue #4324 * chore(ODBC): remove unused vars; fix SQL Server SDK include path #4324 * fix(ODBC): trim UTF16 string #4324 * chore(ODBC): add compile time big string diagnostics #4324 * chore(ODBC): add SQLServer big string vector test case #4324 * fix(ODBC): detect SQLServer header #4324 * chore: add listing msodbdcsql18 folder #4324 * ci: change odbc drivers installation order #4324 * chore(CMake): Add option ENABLE_DATA_SQL_SERVER_BIG_STRINGS, auto-detection of msodbcsql.h on Linux and macOS * fix(ODBC): detect backend at runtime for string size; add Session::dbmsName() #4324 * fix(ODBC): wrong char to string conversion #4324 --------- Co-authored-by: cunj123 <n.belusic@pta.hr> Co-authored-by: Matej Kenda <matejken@gmail.com>
76 lines
1.9 KiB
CMake
76 lines
1.9 KiB
CMake
# Sources
|
|
file(GLOB SRCS_G "src/*.cpp")
|
|
POCO_SOURCES_AUTO(ODBC_SRCS ${SRCS_G})
|
|
|
|
# Headers
|
|
file(GLOB_RECURSE HDRS_G "include/*.h")
|
|
POCO_HEADERS_AUTO(ODBC_SRCS ${HDRS_G})
|
|
|
|
# Version Resource
|
|
if(MSVC AND BUILD_SHARED_LIBS)
|
|
source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc)
|
|
list(APPEND ODBC_SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc)
|
|
endif()
|
|
|
|
add_library(DataODBC ${ODBC_SRCS})
|
|
add_library(Poco::DataODBC ALIAS DataODBC)
|
|
set_target_properties(DataODBC
|
|
PROPERTIES
|
|
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
|
|
OUTPUT_NAME PocoDataODBC
|
|
DEFINE_SYMBOL ODBC_EXPORTS
|
|
)
|
|
|
|
target_link_libraries(DataODBC PUBLIC Poco::Data ODBC::ODBC)
|
|
target_include_directories(DataODBC
|
|
PUBLIC
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
|
)
|
|
target_compile_definitions(DataODBC PUBLIC THREADSAFE)
|
|
|
|
# Search for MS ODBC header file which is a pre-requisite to enable
|
|
# ENABLE_DATA_SQL_SERVER_BIG_STRINGS
|
|
find_file(
|
|
_msodbc_h
|
|
|
|
msodbcsql.h
|
|
|
|
HINTS
|
|
|
|
/usr/include
|
|
#macOS
|
|
/opt/homebrew/include/msodbcsql18
|
|
/opt/homebrew/include/msodbcsql17
|
|
#Linux
|
|
/opt/microsoft/msodbcsql18/include
|
|
/opt/microsoft/msodbcsql17/include/
|
|
/opt/microsoft/msodbcsql/include/
|
|
# Windows?
|
|
|
|
NO_CACHE
|
|
)
|
|
|
|
if (_msodbc_h)
|
|
get_filename_component(MSODBC_DIR ${_msodbc_h} DIRECTORY CACHE)
|
|
message(STATUS "ODBC: Found msodbcsql.h in: ${MSODBC_DIR}")
|
|
target_include_directories(DataODBC PUBLIC "${MSODBC_DIR}")
|
|
|
|
if (ENABLE_DATA_SQL_SERVER_BIG_STRINGS)
|
|
target_compile_definitions(DataODBC PUBLIC POCO_DATA_SQL_SERVER_BIG_STRINGS=1)
|
|
else()
|
|
target_compile_definitions(DataODBC PUBLIC POCO_DATA_SQL_SERVER_BIG_STRINGS=0)
|
|
endif()
|
|
else()
|
|
# Disable MS SQL specific setting when msodbcsql.h is not present
|
|
set(ENABLE_DATA_SQL_SERVER_BIG_STRINGS OFF CACHE BOOL FORCE "Enable MS SQL Server big strings")
|
|
endif()
|
|
unset(_msodbc_h)
|
|
|
|
POCO_INSTALL(DataODBC)
|
|
POCO_GENERATE_PACKAGE(DataODBC)
|
|
|
|
if(ENABLE_TESTS)
|
|
add_subdirectory(testsuite)
|
|
endif()
|