[odb-users] "out of the box" project

Boris Kolpackov boris at codesynthesis.com
Wed Oct 29 10:03:52 EDT 2014


Hi Sean,

Sean Clarke <sean.clarke at sec-consulting.co.uk> writes:

> Are there any "out of the box" ODB projects using cmake where all the ORM
> code generation is all taken care of?

The place to look for everything ODB+CMake-related is this Wiki page:

http://wiki.codesynthesis.com/Using_ODB_with_CMake

The current "leader" in CMake support for ODB is Timo Rothenpieler's
module (listed at the top of the page). It even includes the example
that is based on ODB's stock "Hello, World"!

Out of curiosity (I, myself, don't use CMake) I've downloaded his
project ("Download Zip" in the right hand size) and then did:

cd OdbCmake-master
cmake .
make
./odbcmake
unknown database schema ''

A quick look around revealed that the example CMakeLists.txt is
missing the GENERATE_SCHEMA, umm, what would one call it, flag?

After changing this line:

odb_compile(OdbCMake_SOURCES FILES ${OdbCMake_ODB_HEADERS} DB sqlite GENERATE_QUERY GENERATE_SESSION)

To read:

odb_compile(OdbCMake_SOURCES FILES ${OdbCMake_ODB_HEADERS} DB sqlite GENERATE_QUERY GENERATE_SESSION GENERATE_SCHEMA)

And re-running cmake and make:

cmake .
make

I get:

./odbcmake
Hello, John Doe!
Hello, Jane Doe!

count  : 3
min age: 31
max age: 33

Boris



More information about the odb-users mailing list