[CMake] Checking Cpack generator type in script code of (INSTALL SCRIPT

David Cole david.cole at kitware.com
Tue Dec 13 19:33:12 EST 2011


On Tue, Dec 13, 2011 at 7:27 PM, vivek goel <goelvivek2011 at gmail.com> wrote:
> hi,
> I am using
> (INSTALL SCRIPT foo)
>
> inside foo how can I check that generator type is RPM or not ?

You can't. The script is run at "make install" time, which may be run
with or without CPack having invoked it.

What you can do is instead write a script that executes only at CPack
time based on the CPack generator being used.

See the wiki page starting at:
http://www.vtk.org/Wiki/CMake:CPackPackageGenerators#Overall_usage_.28common_to_all_generators.29

for more details, and then let us know if you further questions.


Thx,
David Cole
Kitware, Inc.


>
> I tried with this code
>
> if(CPACK_GENERATOR MATCHES "RPM")
> EXECUTE_PROCESS(COMMAND echo   ${CMAKE_INSTALL_PREFIX})
> endif(CPACK_GENERATOR MATCHES "RPM")
>
> But this code doesn't work.
>
>
>
> regards
> Vivek Goel
>
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list