176 Commits

Author SHA1 Message Date
Derek Huang
018e532382 Consistently define SOCI_DLL and export macros in all builds
Make sure the macros are consistently defined.

Also define SOCI_SOURCE and SOCI_$BACKEND_SOURCE at CMake level to
make sure they are always defined.

Closes #1273.
2025-08-19 20:12:05 +02:00
Vadim Zeitlin
4982b0e37b Merge branch 'cmake-affixes'
Add SOCI_NAME_PREFIX and SOCI_NAME_SUFFIX build options to allow using
custom prefix and/or suffix to distinguish custom SOCI builds.

See #1288.
2025-07-27 01:15:39 +02:00
Vadim Zeitlin
c6abf4ab83 Allow customizing SOCI shared libraries names
Add SOCI_NAME_PREFIX and SOCI_NAME_SUFFIX build options to allow using
custom prefix and/or suffix to distinguish custom SOCI builds.
2025-07-24 23:47:43 +02:00
Vadim Zeitlin
6728849259 Disable MSVC "unreachable code" warnings at CMake level
Not only the compiler seems to give this warning for just a simple
unconditional "throw", but it also has started giving it in a previously
warning-free code, probably due to a micro version update on GitHub CI.

Fighting against is becoming really ridiculous, so just suppress the
warning globally and remove the local suppressions for it which are not
needed any more.
2025-07-24 22:09:02 +02:00
Vadim Zeitlin
a2f8d61242 Get rid of SOCI_INT8_T_IS_CHAR too
As we can't specialize exchange_traits<> for both int8_t and char when
they are the same type (which is the case under Solaris, see #1154),
specialize exchange_traits<> for some wrapper type in this case to avoid
compilation errors.

This is an alternative, and simpler, solution than that of #1170, so we
can now remove soci_are_types_same CMake function.
2025-06-13 01:31:08 +02:00
Vadim Zeitlin
c35b1b6a77 Avoid disabling MSVC CRT security warnings globally
Use "_s" versions of the standard C functions if possible/simple to do
and disable deprecation warnings explicitly in a couple of places where
this could not be done instead of disabling them globally.

Also stop using strcpy() entirely and use strncpy() instead.

See #1268.
2025-06-08 02:49:21 +02:00
Vadim Zeitlin
320a40b93c Avoid annoying FindMySQL warning under Windows
This warning will almost always be given in Windows build, which is not
really helpful.
2025-06-07 20:07:23 +02:00
Vadim Zeitlin
4f1d2e959f Remove unneeded CheckCXXSourceCompiles inclusion from FindMySQL
We don't check for compilation of anything here.
2025-06-07 20:06:21 +02:00
Vadim Zeitlin
65b4c9ce08 Disable compiler logo display when using MSVC 2025-06-07 18:55:15 +02:00
Vadim Zeitlin
ad27c2ffc2 Restore ABI version use in Windows DLL names
This was lost during CMake rewrite, but it makes sense to keep doing it,
as it's a common convention under Windows due to the absence of
SOVERSION equivalent, and it broke dynamic backend loading by name.

Fix this by moving ABI_VERSION definition to the main CMakefile and also
defining ABI_SUFFIX there, if necessary, which is appended to the names
of all libraries, if it is defined.

See #1248.
2025-05-15 20:59:00 +02:00
Vadim Zeitlin
5c39137ded Set compiler warning options for C++ sources only
Also make the use of generator expressions less horrible by defining a
variable with a readable name containing the condition checked.
2025-04-25 01:06:43 +02:00
Vadim Zeitlin
9371f32fa1 Add SOCI_SQLITE3_BUILTIN CMake variable
This can be used either to disable using the built-in SQLite version or,
on the contrary, force using it even if the system version is available.
2025-04-25 00:25:15 +02:00
Vadim Zeitlin
9e308de736 Merge branch 'cmake-fixes'
CMake fixes, notably when reconfiguring, and simplifications.

See #1231.
2025-04-22 13:56:40 +02:00
Vadim Zeitlin
21a53c9e4a Remove REQUIRED argument from soci_public_dependency() too
All dependencies are currently required, so just hardcode this.
2025-04-17 01:07:12 +02:00
Vadim Zeitlin
5a3ae7427e Drop support for dependency macros and components
This is not used any more after the previous commits and can be just
removed, simplifying things.
2025-04-17 01:07:12 +02:00
Vadim Zeitlin
416ceb119c Drop unused macros support code in soci_define_backend_target()
This is not used by any of the existing backends and doesn't seem
useful, so just remove support for automatically defining some macros
when the backend is used.
2025-04-16 18:52:34 +02:00
Vadim Zeitlin
11c063c2fb Fix name of soci_public_dependency() argument
DEP_TARGETS was missing the "S".

Also indicate that there can be more than one target after it.
2025-04-16 17:56:39 +02:00
Vadim Zeitlin
8b7cd3020d Rename BACKEND_NAME parameter to just NAME
This avoids having to use ugly DEFINE_BACKEND_BACKEND_NAME.
2025-04-12 17:57:32 +02:00
Vadim Zeitlin
d3d6c9b7e6 Remove separate ALIAS_NAME for the backends
It's always the same as BACKEND_NAME and there just doesn't seem to be
any good reason to have 2 variables with exactly the same name.

No real changes.
2025-04-12 17:57:32 +02:00
Vadim Zeitlin
d6aae678b1 Fix variable reference in soci_verify_parsed_arguments()
This resulted in a syntax error due to missing "}".
2025-04-12 17:57:32 +02:00
Vadim Zeitlin
a5663d9c40 Stop checking further dependencies if one of them is not found
This is academic for now as all backends have a single dependency
anyhow, but stop looking for any subsequent ones if any of them is not
found as it's useless.
2025-04-12 17:57:32 +02:00
Vadim Zeitlin
20e2b168b6 Don't pass ENABLED_VARIABLE to soci_define_backend_target()
This variable always has the form of SOCI_<BACKEND_NAME> and code
elsewhere already constructs it dynamically, so this can't be really
changed.
2025-04-12 17:57:32 +02:00
Vadim Zeitlin
e337a092d4 Merge branch 'cmake-boost-option'
Add back CMake WITH_BOOST option.

See #1227.
2025-04-11 14:48:48 +02:00
Vadim Zeitlin
0fd87b66e6 Build SQLite3 ourselves if it's not otherwise available
Use sources from the submodule to create soci_sqlite3_builtin library.
Recommend cloning with --recurse-submodule to ensure that the submodule
is available and update AppVeyor CI to initialize submodules too.

Add "BUILTIN" dependency mode to soci_define_backend_target() and use it
for SQLite3 backend.

Note that because SQLite3 source is C, and not C++, this language needs
to be explicitly added to CMake project() function, otherwise C files
are just silently ignored.

This commit is best viewed ignoring whitespace-only changes.
2025-04-11 01:53:56 +02:00
Vadim Zeitlin
019a32c6e5 Fix wrong CMake variable expansion in an error message
Close the curly brace which was left opened.
2025-04-09 16:25:08 +02:00
Vadim Zeitlin
21c29ddb00 Also remove REQUIRED_COMPONENTS from soci_define_backend_target()
This is similar to the parent commit, but REQUIRED_COMPONENTS is even
more egregious because it can never be possibly set to a value different
from SOCI::Core: all backends depend on the core library and they must
not depend on any other SOCI libraries.
2025-03-24 14:14:47 +01:00
Vadim Zeitlin
97e8947ec4 Remove PRIVATE_INCLUDE_DIRS soci_define_backend_target() parameter
It's not really useful, as it's the same for all backends, so just
hardcode the private include directory name inside the function.

No real changes.
2025-03-24 12:26:24 +01:00
Robert Adam
c80c9c4f11 Fix MySQL backend build when using vcpkg
vcpkg sets things up for including mysql/mysql.h to work, but we want to
include just mysql.h for consistency with the other environments, so add
the extra segment to its include path.

Closes #1218.
2025-03-24 00:14:00 +01:00
Vadim Zeitlin
eb6958b92e Install SOCI libraries directly in CMAKE_INSTALL_LIBDIR
Don't create a subdirectory for them, this is unconventional and
incompatible with the behaviour before #1118.

Closes #1213.
2025-03-05 17:18:46 +01:00
Vadim Zeitlin
fb04446e35 Convert most HTTP links to HTTPS
No real changes, but it's not very serious to use HTTP links in 2025.
2025-03-04 18:03:53 +01:00
Vadim Zeitlin
1f9a1562a7 Search for MariaDB using pkg-config too
Accept either mysqlclient or libmariadb packages in MySQL backend
configuration.
2025-02-27 21:00:45 +01:00
Vadim Zeitlin
705780a8bd Transform MySQL_INCLUDE_DIRS only when using config program
This is not necessary in the other cases, such as when using pkg-config.

It's also not necessary to do it for MySQL_LIBRARIES as the arguments to
target_link_libraries() can be arbitrary linker options too.

Finally, make the regex more precise and only remove "-I" and, also,
"-isystem", instead of anything starting with "-".
2025-02-27 20:56:13 +01:00
Vadim Zeitlin
30f9e222f8 Fix handling of SOCI_LD option
Set options for soci_compiler_interface, not the non-existent
soci_compiler_options target.

This was missed in a51a5e4e (Move compiler flag options + handling to
dedicated file, 2025-02-02).
2025-02-27 20:54:21 +01:00
Robert Adam
8945e5a0ca Make use of separate_arguments CMake function 2025-02-27 20:15:46 +01:00
Robert Adam
845b3de53a FindMySQL: Convert flags into a form consumable by CMake 2025-02-27 20:05:17 +01:00
Robert Adam
51b7220e25 Fix typo 2025-02-22 18:06:58 +01:00
Robert Adam
2c26b9ebea Make new find modules compatible with old variables 2025-02-22 17:30:18 +01:00
Robert Adam
01ab513b74 Improve FindMySQL.cmake
The improved version should make sure to always print a found message
(unless QUIET) is specified and it should respect externally specified
MySQL_INCLUDE_DIRS etc. variables in cases in which MySQL is not found
via vcpkg or pkg-config.

The weird dance with SOCI_MYSQL_DIRECT_INCLUDE has also been dropped,
assuming that the include path is always configured to allow a direct
include of the mysql.h header.
2025-02-22 17:12:28 +01:00
Robert Adam
b08851aaf7 Update find module description 2025-02-06 20:05:16 +01:00
Robert Adam
7f350d02d6 Don't hide ASAN flags behind generator expressions 2025-02-02 18:50:08 +01:00
Robert Adam
310d14dfc4 Only define interface library, if Oracle has been found 2025-02-02 09:51:11 +01:00
Robert Adam
511970c11c Remove redundant if statement 2025-02-02 09:49:39 +01:00
Robert Adam
a51a5e4e29 Move compiler flag options + handling to dedicated file 2025-02-02 09:37:50 +01:00
Robert Adam
f9c540821f Merge remote-tracking branch 'upstream/master' into revamp-cmake 2025-01-26 19:03:27 +01:00
Robert Adam
77c2e170cd De-duplicate boilerplate by using function to define backend target 2025-01-26 18:56:01 +01:00
Robert Adam
af92da7caf Properly integrate new type check with new cmake layout 2025-01-03 19:28:10 +01:00
Robert Adam
9244c88e38 Fix bug in soci_verify_parsed_arguments 2025-01-03 19:22:41 +01:00
Robert Adam
858d5852a0 Actually set compiler flags for UBSAN 2025-01-03 16:25:12 +01:00
Vadim Zeitlin
b0ecbca57a Extract common tests in soci_tests_common library
This allows to compile them once, instead of doing it for every backend:
while this doesn't matter for the CI builds, recompiling common-tests.h
a dozen times enormously slowed down local builds using all backends.

Now it is compiled only once, as test-common.cpp, and all the other
tests (except for the "empty" one) just link with the resulting library.

Also extract some parts of this file into separate headers, that can be
included only by the tests that actually need them.

Note that the entire test-common.cpp probably ought to be split into
multiple files, to speed up its build too, but this can be done later.
2024-10-23 13:54:01 +02:00
Vadim Zeitlin
fc5d78db0d Add SOCI_UBSAN build option
Allow to easily enable UBSAN.

Don't bother to test for the compiler versions, assume that when someone
enables it, they have compiler support for it.
2024-10-16 17:11:43 +02:00