How to make cmake script for ecpg and qt project?

348 Views Asked by At

How to make cmake build script for project that use ecpg code generation and qt moc compiler?

Also how to add code generation in cmake (which is easy in make)?

1

There are 1 best solutions below

2
On

This is how we added code generation for ecpg in cmake.

set( PGSQL_CMD "/usr/pgsql-9.3/bin/ecpg" )
set( PGSQL_ARG "input_file.pgc" )
add_custom_command( OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/output_file.c
                    COMMAND ${PGSQL_CMD} ${PGSQL_ARG}
                    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/input_file.pgc
                    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )