[odb-users] ODB + Cmake
Timo Rothenpieler
timo at rothenpieler.org
Fri May 15 12:55:00 EDT 2015
> cmake_minimum_required(VERSION 2.8.12)
>
> project(OdbCMake)
>
>
> # Find includes in corresponding build directories
> set(CMAKE_INCLUDE_CURRENT_DIR ON)
>
> list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
>
> find_package(ODB REQUIRED COMPONENTS qt pgsql)
> find_package(Qt5Core REQUIRED)
> include(${ODB_USE_FILE})
>
> set(OdbCMake_SOURCES
> driver.cpp
> database.h)
>
> set(OdbCMake_ODB_HEADERS
> person.h)
>
> odb_compile(OdbCMake_SOURCES FILES ${OdbCMake_ODB_HEADERS} DB pgsql
> GENERATE_QUERY GENERATE_SESSION)
>
> add_executable(odbcmake
> ${OdbCMake_SOURCES}
> ${OdbCMake_ODB_HEADERS})
> target_link_libraries(odbcmake
> ${ODB_LIBRARIES})
You're not telling it to link to Qt5, just finding the package does
nothing on its own.
> target_include_directories(odbcmake
> PRIVATE
> ${ODB_INCLUDE_DIRS}
> ${ODB_COMPILE_OUTPUT_DIR})
> target_compile_definitions(odbcmake
> PRIVATE
> DATABASE_PGSQL)
>
>
> Thank you,
>
> Diego Fernando
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
Url : http://codesynthesis.com/pipermail/odb-users/attachments/20150515/5691c34e/signature.pgp
More information about the odb-users
mailing list