Poco 1.9.0: Data to SQL
~ 2 minute read.
This is a very specific problem to which I put up the solution for those of you googling for it.
To save you some time: the “Data” namespace in Poco has been renamed to “SQL” in POCO 1.9.1. This can take shape in the following errors, in case you search for them:
CMake Find Error
When compiling your existing project, you may run into the following error after compiling POCO:
> cmake .. -DCMAKE_INSTALL_PREFIX=C:\local -A x64 CMake Error at [...]/cmake/PocoConfig.cmake:29 (find_package): Could not find a package configuration file provided by "PocoData" with any of the following names: PocoDataConfig.cmake pocodata-config.cmake Add the installation prefix of "PocoData" to CMAKE_PREFIX_PATH or set "PocoData_DIR" to a directory containing one of the above files. If "PocoData" provides a separate development package or SDK, be sure it has been installed. Call Stack (most recent call first): CMakeLists.txt:28 (find_package) -- Configuring incomplete, errors occurred! See also "[...]/CMakeFiles/CMakeOutput.log".
Solution
Make sure to compile POCO with -DPOCO_ENABLE_SQL_<DB>=ON
, where <DB>
is one of the
databases you’d like to use, e.g. SQLITE
or MYSQL
.
You then need to make sure to change the name of the component in the find_package
call:
+ find_package(POCO REQUIRED Data DataSQLite) - find_package(POCO REQUIRED SQL SQLSQLite)
Missing CMake Target
You will get this as a followup:
CMake Error at src/CMakeLists.txt:3 (add_library): Target "[...]" links to target "Poco::DataSQLite" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?
Solution
Change all occurances of Poco::DataSQLite
cmake target to Poco::SQLSQLite
in
your target_link_library
calls analog to the find_package
call.
Compile Errors
The followup error is a compile error:
[...]: error C2039: 'Data': is not a member of 'Poco' [...]
Hence, now you need to refactor all uses of the Data
namespace to SQL
.
Hope this saved you a minute!
Written in 30 minutes.