Hi,

I have a mid scale project which i recently decided to move from lumbering netbeans to qtcreator and change the build system to qmake. It consists of a core library, a gui library, various tests and executables.

Directory structure goes like this

Qt Code:
  1. libcore
  2. string.h
  3. signal.h
  4. a.h
  5. b.h
  6. a.cpp
  7. b.cpp
  8. libgui
  9. widget_a.h
  10. widget_a.cpp
  11. form_a.ui
  12. form_a.h
  13. form_a.cpp
  14. form_b.ui
  15. form_b.h
  16. form_b.cpp
  17. tests and executables
  18. test directory
  19. test_a.h
  20. test_a.cpp
  21. executable directory
  22. exe_a.h
  23. exe_a.cpp
To copy to clipboard, switch view to plain text mode 

As you can see, i have some header names like "string.h" and "signal.h" and because of that, when a library is built, it is supposed to go into build directory like this.

Qt Code:
  1. build_direcotory
  2. include
  3. tbs
  4. string.h
  5. signal.h
  6. widget_a.h
  7. ui_widget_a.h // Generated as result of uic causes directory
  8. // to be added to include path
  9. etc...
  10. lib
  11. libcore.a
To copy to clipboard, switch view to plain text mode 

To achieve this, i have an pri file and a function in it. (macro / test ?)
which does configuration _almost_ correctly

Qt Code:
  1. # ----------------------------------------------------------------------------
  2. header_copy.input = HEADERS
  3. header_copy.commands = @$$QMAKE_COPY ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT}
  4. header_copy.output = ../include/tbs/${QMAKE_FILE_BASE}.h
  5.  
  6. # ----------------------------------------------------------------------------
  7. defineTest(configuration) {
  8. target_name = $$1
  9. target_type = $$2
  10. output_directory = $$3
  11.  
  12. TARGET = $$target_name
  13. INCLUDEPATH = $$output_directory/include
  14. LIBS += -L$$output_directory/lib
  15.  
  16. contains(target_type, lib) {
  17. TEMPLATE = lib
  18. CONFIG += staticlib
  19. DESTDIR = $$output_directory/lib
  20. UI_DIR = $$output_directory/obj/ui
  21. #UI_HEADERS_DIR = $$output_directory/include/tbs
  22. QMAKE_EXTRA_COMPILERS += header_copy
  23. }
  24. else:contains(target_type, exe) {
  25. DESTDIR = $$output_directory/bin
  26. TEMPLATE = app
  27. debug {
  28. CONFIG += console
  29. }
  30. }
  31.  
  32. export(TARGET)
  33. export(TEMPLATE)
  34. export(CONFIG)
  35. export(DESTDIR)
  36. export(UI_DIR)
  37. export(UI_HEADERS_DIR)
  38. export(INCLUDEPATH)
  39. export(LIBS)
  40. export(HEADERS)
  41. export(QMAKE_EXTRA_COMPILERS)
  42. }
To copy to clipboard, switch view to plain text mode 

Which is called from each "pro" file like this
Qt Code:
  1. include (../tbs_desktop.pri)
  2. configuration(tbs, lib, ..)
To copy to clipboard, switch view to plain text mode 

This does most of the job as intended. However the commented out line which places generated headers to their correct place, also adds that directory to include path. Resulting headers like "string.h" and "signal.h" to be included from standart library and Qt in place of intended headers. Creating a thousand lines long compile time mess.

I've tried :

Qt Code:
  1. INCLUDEPATH -= $$UI_HEADERS_DIR
To copy to clipboard, switch view to plain text mode 
which had no effect, and attempted to replace command that executes uic with

Qt Code:
  1. # ----------------------------------------------------------------------------
  2. UIC.input = FORMS
  3. UIC.commands = @$$QMAKE_UIC ${QMAKE_FILE_NAME} -o ../include/tbs/${QMAKE_FILE_BASE}.h && echo ehore
  4. UIC.output = ../include/tbs/${QMAKE_FILE_BASE}.h
  5. QMAKE_EXTRA_COMPILERS += UIC
To copy to clipboard, switch view to plain text mode 
but this created another mess.

Is there a way to prevent UI_HEADERS_DIR from being added to include path or any other way to work around this issue?

* autotools is not an option as it is not really cross platform. (it requires a full blown unix environment to work)
* CMake is an option but it requires re-write of build system and i'm a total newbie to it.