Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.9.3
-
None
-
OS: macOS High Sierra
Version 10.13.2
MacBook Pro (Retina, 13-inch, Early 2015)
Qt version 5.9.3
CMake version 3.7.2
Description
With following setup:
CMakeLists.txt
project("proj") set(CMAKE_PREFIX_PATH "$ENV{QTDIR}") find_package(Qt5Core REQUIRED) find_package(Qt5Widgets REQUIRED) set(CMAKE_INCLUDE_CURRENT_DIR "YES") set(CMAKE_AUTOMOC "YES") set(CMAKE_AUTOUIC "YES") add_executable("proj" MACOSX_BUNDLE main.cpp) target_link_libraries("proj" Qt5::Core Qt5::Widgets)
form.ui
<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>Form</class> <widget class="QWidget" name="Form"> </widget> <resources/> <connections/> </ui>
main.cpp
#include "ui_form.h" int main() { }
I get following error:
$ cmake --build . Scanning dependencies of target proj_automoc [ 25%] Automatic moc and uic for target proj Generating moc compilation proj_automoc.cpp [ 25%] Built target proj_automoc Scanning dependencies of target proj [ 50%] Building CXX object CMakeFiles/proj.dir/main.cpp.o main.cpp:1:10: fatal error: 'ui_form.h' file not found #include "ui_form.h" ^ 1 error generated. make[2]: *** [CMakeFiles/proj.dir/main.cpp.o] Error 1 make[1]: *** [CMakeFiles/proj.dir/all] Error 2 make: *** [all] Error 2
However if I move include to the second line everything works
main.cpp
#include "ui_form.h" int main() { }