On 2019-01-19 00:09-0000 Scott Bloom wrote:

I use qt + google test to run tests in my build environment.

The problem I have, is in some (most) of my unit test directories, there will 
be multiple test executables created, all dependent on the same output file 
from the add_resources step.

Typically its something like

qt_add_resource( resourceVar resource.qrc )

add_executable( test1 test1main.cpp ${resourceVar} )
add_executable( test2 test2main.cpp ${resourceVar} )

On windows (running the build from cmake through visual studio with parallel 
building turned on) this sometimes (1 out of 20 or 30 builds or so) causes a 
race condition, where the dependency on the qrc_resource.cpp is attempted to be 
generated by both executable dependencies at once.

Not sure what is going on, but wondering if there was any advice out there for 
this problem

Hi Scott:

I could find no google hits for qt_add_resource (except for your
question).  But that search did ask is "qt5_add_resources" what
you meant?
If so there is a rather old but still useful
discussion at
for what appears to be exactly the problem you describe.  See
especially the CMake code associated with this comment:

"The workaround is to add a custom target and add explicit depends on that".

Actually, regardless of causes and whether you were refererring to
qt5_add_resources or not I think that workaround will work to solve
your issue since in a parallel build environment a custom target and
relevant dependencies on that target always assures just one build
(rather than multiple builds which race with each other) of whatever
it refers to.

Alan W. Irwin

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).

Linux-powered Science

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 

Follow this link to subscribe/unsubscribe:

Reply via email to