I found a bug using the same external data file with multiple tests.  When
I specify the same file in three different tests, I get an error:

CMake Error: Attempt to add a custom rule to output
"/home/ubuntu/misc/large_image/_build/data/plugins/large_image/sample_image.ptif.sha512-stamp.rule"
which already has a custom rule.

Specifically, I'm using cmake ExternalData via the route exposed in
Girder's build process.  I have a branch here:
*https://github.com/DigitalSlideArchive/large_image/blob/0b06690265866d3bb3f0f92132716fe1e5ad3c69/plugin.cmake#L74
<https://github.com/DigitalSlideArchive/large_image/blob/0b06690265866d3bb3f0f92132716fe1e5ad3c69/plugin.cmake#L74>*
 where I include external data in multiple tests.  I have three test files
that are used in various tests, but not all are used in each test.  I can
use any data file TWICE, but not three times.

The error is thrown when add_custom_command is called in
Modules/ExternalData.cmake, and that function(ExternalData_add_target
target) is called the number of times I expect.  This function sets a
variable called _ExternalData_FILE_${file} to avoid adding custom commands
more than once, but the context is such that this variable is never set
when the function gets called.

I have attached a patch that fixes this problem and tests the fix.

- David

-- 
David Manthey
R&D Engineer
Kitware Inc.
(518) 881-4439

Attachment: 0001-Allow-external-files-in-multiple-tests.patch
Description: Binary data

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

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 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to