How to place header and ui file in different folde

2019-02-17 16:02发布

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?

标签: c++ qt cmake
2条回答
该账号已被封号
2楼-- · 2019-02-17 16:34

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

查看更多
【Aperson】
3楼-- · 2019-02-17 16:39

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.

查看更多
登录 后发表回答