[CMake] How to disable the CPack preinstall build?

Duncan Chisholm duncan at nacnud.ca
Wed Jul 6 17:00:29 EDT 2016


Hello All,

I'm looking for some CPack (3.5.2) wrangling assistance...

I have CMake automatically generating a unique ID on every build. This ID
is compiled into several components of my project and I want the same value
to appear in my package file name. I do this by inserting it into a CPack
project config file at build time.

This works great in Visual Studio and XCode. When I build the package
target, a new ID is generated, all the dependents are rebuilt and the
package is created with the correct file name.

However, it doesn't work for makefiles. When I execute 'make package',
CMake subsequently executes 'make preinstall'. This causes two build IDs to
be generated; the first ending up in the package filename and the second
ending up in my modules (which are compiled twice).

As a workaround, I've found that if I edit the CPackConfig.cmake file to
replace CPACK_CMAKE_GENERATOR "Unix Makefiles" with "Xcode", it works.
CPack apparently knows that it doesn't need to worry about building
anything in this case.

So... Is there a better way to get this message across to CPack? Just
package; don't build.

Duncan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160706/17c72330/attachment.html>


More information about the CMake mailing list