Variables starting with “CPACK_” control the behavior of CPack, right? Most of these variables are documented in the CPack help page. Some, however, are documented in the top-level variables list (https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html#variables-for-cpack). Why?
It just evolved that way. At least historically, those in the CPack
module’s documentation are variables that either control the module or are explicitly initialized by it. The rest are blindly passed through by this code to CPackConfig.cmake
and not interpreted until cpack(1)
sees them.
I think it would be fine to consolidate them in one direction or the other.
Generic variables are documented with any other CMake variables.
Generator specific variables are documented within CPack generators.
I agree that CPack help page should at least give a pointer to https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html#variables-for-cpack
and ideally the doc there should be moved in CPack page
Hey, Brad—can you comment on this advice I gave four years ago? A commenter on SO asked a few days ago whether this behavior was documented anywhere—specifically, the behavior of passing through all variables with names that start with CPACK_
, but also: creating local copies of these variables that have the CPACK_
prefix removed[?] (Full disclosure: I’m assuming it does the latter—or did four years ago—based on my SO answer. But I’ve not used CPack in awhile, and I may be misremembering the details).
The CPACK_
variable pass-through is called here and implemented here. I don’t see this explicitly stated in the documentation, but it is partially mentioned here.
Got it, thanks! So… do you think it’s safe to rely on this behavior, or is it an implementation detail that might change someday? I’d like to respond to the commenter on SO, but I’m not sure what to tell them. (I want to say of course it’s okay to rely on this behavior, because it seems to me that a whole bunch of generators would break if it were ever to change, but… that’s just a hunch based on my fairly limited exposure to CPack.)
Yes, it should be stable behavior, thanks.