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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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 "-".
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).
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.
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.