Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find .pro file for sub dir - when subdir contains relative path

Tags:

qt

qt5

qmake

I've got a top-level .pro file with subdirs template

TEMPLATE = subdirs

SUBDIRS += \
    common/tests

common/tests contains .pro file, but qmake couldn't find it:

Could not find .pro file for sub dir "common/tests" in "/home/o.antonyan/Documents/mt3/main/src/common/tests"

But it's there:

ls /home/o.antonyan/Documents/mt3/main/src/common/tests
api             interfaces            Makefile          tests_common.pro.user  ui
dataformat.cpp  local_enviroment.cpp  tests_common.pro  types

If I move this pro file to parent directory and modify topp-level qmake SUBDIRS += common then it works. The problem is only when subdirs contain relative path more than 1 level deep.

QMake version 3.0 Using Qt version 5.4.1 on GNU/Linux x86, Qt compiled from sources

like image 346
Oleg Antonyan Avatar asked Apr 09 '15 10:04

Oleg Antonyan


2 Answers

From the docs:

It is recommended that the project file in each subdirectory has the same base name as the subdirectory itself, because that makes it possible to omit the file name. For example, if the subdirectory is called myapp, the project file in that directory should be called myapp.pro.

Try renaming tests_common.pro to tests.pro.

like image 64
svlasov Avatar answered Sep 22 '22 17:09

svlasov


I had the same problem and found this solution for the top level .pro file:

TEMPLATE = subdirs

tests_common.file = tests/tests_common.pro

SUBDIRS += tests_common

But now I would prefere the answer of svlasov.

like image 43
Stefan Wüthrich Avatar answered Sep 22 '22 17:09

Stefan Wüthrich