uic + CMake + GCC + custom widgets + out-of-source problem
-
@SGaist Thank you for your assistance.
Firstly, adding the three lines setting those global variables does not eliminate the error in question.
Secondly, do they change anything given the following line was already present?set_target_properties(minitest PROPERTIES AUTOUIC ON AUTOMOC ON AUTORCC ON)
-
I've just realized that the error message would probably be helpful.
In file included from (scrubbed)/min-s/main.cpp:1: (scrubbed)/min-m/minitest_autogen/include/ui_ui.h:15:10: fatal error: betterbutton.h: No such file or directory 15 | #include "betterbutton.h" | ^~~~~~~~~~~~~~~~ compilation terminated.
-
@stan423321 said in uic + CMake + GCC + custom widgets + out-of-source problem:
betterbutton.h
Where is it located?
-
All 4 files described in opening post are in the min-s directory. Next to it there's a min-m directory where I build it.
-
You don't seem to add the directory to the include search paths.
-
Is that the standard practice for working with .ui files? It doesn't seem right to me, this breaks the separation of system headers and project ones. Also, I can't help but wonder why MSVC wouldn't need this...
-
I am not sure to follow your question here.
You told us that you have files in subdirectories but yet you do not provide the necessary include paths for the compiler to find the headers in your sub folder.
-
Well, if I include them from .cpp files, both GCC and MSVC automatically know to look in the folder with the source file. I have never before used the include path for in-project files, all the advice I have followed before recommended using include paths just for libraries (e.g. Qt). Not to mention, in a more complex setup, it would break relative paths.
-
It depends all on how you write your includes in your code.
cmake provides the CMAKE_INCLUDE_CURRENT_DIR variable so you can ensure that your project folder is used for the includes.
-
Well, huh. I thought I tried that one with the bigger project before, but it does work with the test program here, so that must have been something else. Thank you for your assistance.