Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to place header and ui file in different folders using autouic in cmake

Tags:

c++

cmake

qt

According to the documentation, regarding autouic:

If a preprocessor #include directive is found which matches ui_.h, and a .ui file exists, then uic will be executed to generate the appropriate file.

But what if the .ui file is in another folder? I currently get the following error when trying to build:

AUTOUIC : error : process for ui_module.h failed:
File 'C:/app/source/headers/module.ui' is not valid

The ui file is actually located here:

C:/app/source/forms/module.ui

I've tried to add the C:/app/source/forms/ to the include_directories()-macro without success. Any ideas?

like image 661
A.Fagrell Avatar asked Nov 16 '16 11:11

A.Fagrell


2 Answers

Issue mentioned in this answer is now resolved.

This worked in CMake v3.9.0-rc6:

set(CMAKE_AUTOUIC_SEARCH_PATHS your/folder/here)

See documentation of AUTOUIC_SEARCH_PATHS.

like image 125
AMA Avatar answered Nov 01 '22 19:11

AMA


Update

A search path, CMAKE_AUTOUIC_SEARCH_PATHS, has been added to CMake version 3.9.


After further investigation, it seems like it's not possible to do. There is an open issue in their tracking system, but it is so far not implemented:

Add Search path for AUTOUIC

like image 40
A.Fagrell Avatar answered Nov 01 '22 18:11

A.Fagrell