[CMake] Conditional install

Eric Noulard eric.noulard at gmail.com
Wed Aug 12 03:20:07 EDT 2009


2009/8/11  <rozelak at volny.cz>:
> Hallo,
>
> thank you for your reply. I have tried to set the COMPONENT in the INSTALL()
> command, but it did not lead to the expected result. The install command
> I changed to (ONLY for the target I want to install, inspired by http://www.cmake.org/pipermail/cmake/2006-October/011362.html):
>
> INSTALL(TARGETS ${LIB_NAME}  DESTINATION lib  COMPONENT dist )
>
> and called as
>
>>$ cmake COMPONENT=dist -P cmake_install.cmake ../

This line is doing an installation (look at the output).

>>$ make

Then you build the software, strange enough to build AFTER installing.

>>$ make package # CPack is configured ...

Then you re-install through CPack and run cpack for building the package.

The first command line "cmake -DCOMPONENT=dist ..." and
the last one "make package" are unrelated.

You should read that:
http://www.vtk.org/Wiki/CMake:Component_Install_With_CPack

> still adds also the targets NOT having COMPONENT filled (the libraries
> joined by svn:externals and statically linked) into the package built.
> And I cannot change CMakeLists.txt except the one in my target ...

OK but as far as I know
it is not enough to use COMPONENT and get it work with CPack.
You should:
   1) tell CPACK you want component installer using
      set(CPACK_COMPONENTS_ALL ....)

   2) use a CPack generator that do support COMPONENT installer
      not ALL but a few CPack generator do support COMPONENT.

For example DEB and RPM don't:
http://public.kitware.com/Bug/view.php?id=7645
NSIS does.
TGZ, ZIP ==> I don't know.

What CPack generator are you using? ZIP, TGZ, NSIS, RPM, DEB ??

> Do you think that my original requirement is meaningful enough for feature
> request to be filled?

Yes I think it is but may be you are "only" lacking the COMPONENT
install for you target CPack generator.

>
> Thank you very much,
> DanT.




-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list