MantisBT - CMake
View Issue Details
0014956CMakeDocumentationpublic2014-06-04 16:242016-06-10 14:31
mwoehlke 
Kitware Robot 
normaltextN/A
closedmoved 
CMake 3.0 
 
0014956: install(CODE/SCRIPT) and components documentation mismatch
The install(CODE) install(SCRIPT) commands accept a COMPONENT (and appear to DTRT if given one), but the documentation does not mention this. The documentation should be corrected.

(Alternatively, one could argue that these are not meant to consider the component, but at least the documentation and actual behavior should agree.)
No tags attached.
related to 0005868closed David Cole INSTALL command should handle COMPONENT support for SCRIPT and CODE signatures 
has duplicate 0015247closed  install([[SCRIPT <file>] [CODE <code>]] [...]) missing documentation for COMPONENT argument 
Issue History
2014-06-04 16:24mwoehlkeNew Issue
2014-06-04 16:25mwoehlkeSummaryinstall(CODE/SCRIPT) and components => install(CODE/SCRIPT) and components documentation mismatch
2014-06-05 09:24Brad KingRelationship addedrelated to 0005868
2014-06-05 09:36Brad KingNote Added: 0036124
2014-06-05 09:39Brad KingNote Added: 0036125
2014-06-05 11:07mwoehlkeNote Added: 0036126
2014-06-05 11:11Brad KingStatusnew => backlog
2014-06-05 13:34David ColeNote Added: 0036127
2014-06-05 14:03mwoehlkeNote Added: 0036128
2014-11-13 08:34Brad KingRelationship addedrelated to 0015247
2014-11-13 08:34Brad KingRelationship replacedhas duplicate 0015247
2014-11-13 08:43Brad KingNote Added: 0037204
2016-06-10 14:29Kitware RobotNote Added: 0042559
2016-06-10 14:29Kitware RobotStatusbacklog => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0036124)
Brad King   
2014-06-05 09:36   
It looks like this was implemented back in 2007:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c8e832dcf [^]

but the documentation was never updated.
(0036125)
Brad King   
2014-06-05 09:39   
I had never implemented component support for the install(CODE) and install(SCRIPT) commands originally because the code/script could simply check CMAKE_INSTALL_COMPONENT itself. However, the current behavior has been in place for so long we cannot change it now. We should just update the documentation to explain it.

We could then add new behavior like using an empty component name or some other explicit option to ask that the install(CODE) or install(SCRIPT) logic work without any component test. This would allow the loaded code to always execute and test CMAKE_INSTALL_COMPONENT itself once again.
(0036126)
mwoehlke   
2014-06-05 11:07   
> We could then add new behavior like using an empty component name or some other explicit option to ask that the install(CODE) or install(SCRIPT) logic work without any component test.

Yes, that's exactly the lines I was thinking along. I'd probably go with either an explicit option (e.g. "ANY_COMPONENT", "ALL_COMPONENTS", "NO_COMPONENT", ...) or a "special" component (probably "ALL"). An explicitly empty component name feels a little odd :-).
(0036127)
David Cole   
2014-06-05 13:34   
Would have been nice to get feedback on this topic back in 2007... Gotta love that agile development - :-)

For consistency's sake and ease of understanding (the INSTALL command is ridiculously hard to understand already), CODE and SCRIPT should have the same behavior and argument support as files.

So you want to run CODE or SCRIPT with *any* component. Why should that be possible if it's not possible to install a file with *any* component?

Whatever install command signature in the CMakeLists file is required to install a file with *any* component, should be use-able as a CODE installation command with a simple substitution: changing

    FILE BobLoblaw.txt

to

    CODE "message(\"Hey, who is Bob Loblaw?\")"

Sorry for not writing the documentation back then... Not that it's a good excuse, but it was before the days when everything was already so well documented.
(0036128)
mwoehlke   
2014-06-05 14:03   
> So you want to run CODE or SCRIPT with *any* component. Why should that be possible if it's not possible to install a file with *any* component?

I should mention that the use case that started this was wanting to include the cmake_install.cmake of an external project. In this case, it's obvious that we don't want a component check and that the included script will deal with components appropriately.

That said, I'm already leaning toward all install signatures having an 'any component' form. :-)
(0037204)
Brad King   
2014-11-13 08:43   
Regardless of whether we add a new component mode later, we can at least document the current behavior:

 Help: Document COMPONENT option of install(SCRIPT/CODE)
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7361e810 [^]
(0042559)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.