Is there any way to exclude one file from statement
I want to join to SOURCES all .cpp files from src dir but without main.cpp
Is there any way to exclude one file from statement
I want to join to SOURCES all .cpp files from src dir but without main.cpp
Have you tried
Qt Code:
SOURCES += ../src/*.cpp SOURCES -= ../src/main.cppTo copy to clipboard, switch view to plain text mode
Cheers,
_
Yes, but i get and error
I want to join each .h and .cpp file for unit testing project which is a part of subdirs template project.error: multiple definition of `main'
But test project has own main function which is declared by means of command
QTEST_MAIN(myClass)
#include "myClass.moc"
I do not want to add each file separately
HEADERS += myclass.h \
myclass2.h \
itd
SOURCES += myclass.cpp \
myclass2.cpp \
itd \
So I try to find better solution.
Screenshot of project structure
subdirs project.jpg
First solution - common files in src directory, two main.cpp files in subdirs of src.
In pro file You have :
SOURCES += ../src/*.cpp
SOURCES += ../src/subdir/main.cpp
Second solution - one main.cpp with conditional compilation.
Is there any official or good template for projects with unit testing? In Qt documentation i have not found any information about that how to join main project with unit testing. Whether it should be 2 completely separated projects? Or as I use in example above - subdirs template?
See if this works for you:
http://sergey.vlasov.me/2013/03/expa...ith-qmake.html
You will still have to rerun qmake if you add or remove files from any of the globbed directories.
Scope (23rd July 2016)
I also found information that QtCeator sinve 4.0 version has feature called "Autotest integration". It sound promising
http://doc-snapshots.qt.io/qtcreator...-autotest.html
Bookmarks