Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set output path of cmake / qt4 command QT4_WRAP_UI

I use the cmake command QT4_WRAP_UI. Is there an option to control the output path of the generated header files?

like image 575
Christian Avatar asked Oct 25 '10 09:10

Christian


1 Answers

Here is QT4_WRAP_UI source code:

MACRO (QT4_WRAP_UI outfiles )
  QT4_EXTRACT_OPTIONS(ui_files ui_options ${ARGN})

  FOREACH (it ${ui_files})
    GET_FILENAME_COMPONENT(outfile ${it} NAME_WE)
    GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
    SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h) # Here we set output
    ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
      COMMAND ${QT_UIC_EXECUTABLE}
      ARGS ${ui_options} -o ${outfile} ${infile}
      MAIN_DEPENDENCY ${infile})
    SET(${outfiles} ${${outfiles}} ${outfile})
  ENDFOREACH (it)

ENDMACRO (QT4_WRAP_UI)

As you can see, the outfile variable is build from CMAKE_CURRENT_BINARY_DIR variable. You can create a custom macro that will replace that line.

like image 105
tibur Avatar answered Oct 13 '22 05:10

tibur