Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell cmake where ui file generated with autouic is

Tags:

cmake

qt

I have main window class includes:

#include "mainwindow.h"
#include "ui_mainwindow.h"

Where ui_mainwindow.h is source file generated from mainwindow.ui file by cmake AUTOUIC option:

set(CMAKE_AUTOUIC ON)

But if I do my build in another folder called "build" and generated ui_mainwindow.h appears there:

cmake_qt_project\build\ui_mainwindow.h

How to fix the build to include ui_mainwindow.h from another directory or if there is no such possibility generating it in src/ dir?

Also I can not include it in source file as

 #include "build/ui_mainwindow.h"

I need to keep possibility to make build in any dir I want.

like image 780
Vyacheslav Avatar asked Jun 14 '16 11:06

Vyacheslav


1 Answers

Add your build directory to the list of directories searched for include files:

include_directories( ${CMAKE_BINARY_DIR} )
like image 156
DevSolar Avatar answered Oct 23 '22 13:10

DevSolar