[CMake] How to detect whether CMake scripts are executing under / within CPack environment?

Mike McQuaid mike at mikemcquaid.com
Sun Dec 19 15:50:26 EST 2010


On 16 December 2010 08:34, Andreas Mohr <andi at lisas.de> wrote:
> I'd like to know how to possibly detect this within CMake code.

This works for me:
INSTALL( CODE "
IF( \${CMAKE_INSTALL_PREFIX} MATCHES .*/_CPack_Packages/.* )
....
ENDIF( \${CMAKE_INSTALL_PREFIX} MATCHES .*/_CPack_Packages/.* )
" )

However, you then need to put all your CMake logic in INSTALL(CODE
...) logic. Either later tonight or tomorrow I'll post my suggestions
to this list for possible patches I will try and get included to
improve this situation as INSTALL(CODE ...) escaping isn't trivial.

-- 
Mike McQuaid
http://mikemcquaid.com


More information about the CMake mailing list