On 11/09/2015 08:29 PM, Mark Stijnman wrote:

Not in WiX, though - installing the same file from more than one feature is common practice. The shared component will just get a higher reference count. Installing different files to the same location, on the other hand, *is* an error in WiX, which is what I'm running into (even though they're really the same file). It also works as expected in the archive generators - as long as both files are the same, that is, otherwise it is indeed ill-defined.

I think there should be a change in the CMake/CPack behavior here, regardless of whether the WiX generator will be extended to support this use case. For generators that support the same file to be installed from more than one component, such as the archive generators, it should check if the files are the same, and if not, report an error. Generators that don't support two files with the same destination at all should give an error when that occurs.

The installation (staging) logic is out of scope for CPack itself (CPack and CMake are distinct entities; CPack can be used without CMake) and within CMake it probably won't work either...

CMake allows the installation to replace pre-existing files and tries to do so efficiently by using timestamp comparisons and omitting the operation if the source is not in fact newer than the destination. Even though this logic is not required when invoked through CPack (the staging area always starts out empty) it is still there. So replacing an existing file (which may have distinct content from the source) is expected and legal and actually comparing content is probably considered too expensive either way.


        A partial workaround is to put shared files in a separate,
        hidden CPack component/WIX feature, and set component
        dependencies. However, with many shared DLLs, maintaining this
        gets complex really fast, so I'd rather not have to do this.


    I think from CPack's point of view this is the proper thing to do.


It's probably the most portable solution to do this at the CPack level, indeed. However, I found that the CPack WiX generator doesn't support cross-feature dependencies, so I can't automatically install the required files based on the user's feature selections. This is understandable, as WiX itself doesn't appear to have support for this. From what information I could find, the common approach in WiX is indeed to reference the common components (or component groups) from each feature that need them. I'll have to think about the best way to do this.


In the WIX generator I suppose I could perhaps detect reused destination paths (in distinct components) and reuse references but I am not sure I like the idea of actually doing file content comparisons (though in this case it would be much more selective than doing it for the install step).

Also this behavior would be specific to the WIX generator and would likely break semantically with every other generator.

I wonder if I could perhaps instead do this automagically by merging hidden dependee components into their dependers.

If you still think this is a good idea and something you would intend to use please open an issue.

Nils
-- 

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