[odb-users] libodb with cmake

Alex Beimler alex-beimler at web.de
Fri Feb 20 10:13:06 EST 2015


thx it works in this order,
libodb-sqlite.a libodb.a libsqlite3-static.a


also change my cmake-script for the out-of-tree build:

ExternalProject_Add(libodb
             PREFIX ${CMAKE_CURRENT_BINARY_DIR}
             SOURCE_DIR ${THRIDPARTY_DIR}/libodb
             CONFIGURE_COMMAND ${THRIDPARTY_DIR}/libodb/configure 
--prefix=${CMAKE_CURRENT_BINARY_DIR}
             BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/libodb
             BUILD_COMMAND make install
             INSTALL_COMMAND ""
             INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR})

ExternalProject_Add(libodb-sqlite
         DEPENDS libodb sqlite3
         PREFIX ${CMAKE_CURRENT_BINARY_DIR}
         SOURCE_DIR ${THRIDPARTY_DIR}/libodb-sqlite
         CONFIGURE_COMMAND ${THRIDPARTY_DIR}/libodb-sqlite/configure 
--with-libodb=${ODB_LIBRARY_DIR} --prefix=${CMAKE_CURRENT_BINARY_DIR}
         BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/libodb-sqlite
         BUILD_COMMAND make install
         INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}
         INSTALL_COMMAND "")


Am 20.02.2015 um 13:39 schrieb Boris Kolpackov:
> Hi Alex,
>
> Alex Beimler <beimler at jaeschke.de> writes:
>
>> Is there a option to setup the build-dir for the obj-Files?
> This is a standard autotools build system. You can build out-of-tree.
>
>
>> My application links:
>> g++ ... -std=c++14 ... -g -Wall .......cpp.o ...  ...-odb.cxx.o ...
>> -o application ... libodb.a libodb-sqlite.a
> When linking statically, the order in which you list libraries is
> important. You need to go from the most specific to the most
> generic. So it should be libodb-sqlite.a libodb.a.
>
> Note also that you can disable building of shared/static libraries
> with the --disable-shared/--disable-static configure options.
>
> Finally, for completeness, if you have both shared and static
> libraries, then the linker will prefer the shared. To change
> this, you can use the -Wl,-Bstatic and -Wl,-Bdynamic options
> on the g++ command line, e.g.,
>
> g++ ... -Wl,-Bstatic -lodb-sqlite -lodb -Wl,-Bdynamic ...
>
> Boris



More information about the odb-users mailing list