MantisBT - CMake
View Issue Details
0009183CMakeCMakepublic2009-06-19 09:402015-07-08 08:57
Gavin Beatty 
Bill Hoffman 
normalfeatureN/A
closedno change required 
CMake-2-6 
 
0009183: No way to determine full install prefix (including DESTDIR)
Sometimes it is useful at install time to edit or delete files instead of using the install() variants.

Example: I would like to delete all old Export${project}.cmake files installed previously at install time. This prevents inclusion of Export${project}-${buildtype}.cmake variants that no longer apply (as there is an include glob in the generated Export${project}.cmake)

My feature request is for a command, macro or variable to give the actual install prefix that install() uses.
I have been hindered in writing a macro for this myself because of bug 0009182 which I reported today.

Here was my attempt:

macro(macro_install_prefix _var)
    set(_destdir "$ENV{DESTDIR}")
    if("${_destdir}" STREQUAL "")
        file(TO_CMAKE_PATH "${CMAKE_INSTALL_PREFIX}" "${_var}")
    else("${_destdir}" STREQUAL "")
        file(TO_CMAKE_PATH "${_destdir}/${CMAKE_INSTALL_PREFIX}" "${_var}")
    endif("${_destdir}" STREQUAL "")
endmacro(macro_install_prefix _var)
No tags attached.
Issue History
2009-06-19 09:40Gavin BeattyNew Issue
2009-09-14 13:18Bill HoffmanStatusnew => assigned
2009-09-14 13:18Bill HoffmanAssigned To => Bill Hoffman
2009-09-14 13:18Bill HoffmanNote Added: 0017446
2015-02-26 16:09Stephen KellyNote Added: 0038088
2015-02-26 16:09Stephen KellyStatusassigned => resolved
2015-02-26 16:09Stephen KellyResolutionopen => no change required
2015-07-08 08:57Robert MaynardNote Added: 0039078
2015-07-08 08:57Robert MaynardStatusresolved => closed

Notes
(0017446)
Bill Hoffman   
2009-09-14 13:18   
Not sure I understand what you want?
(0038088)
Stephen Kelly   
2015-02-26 16:09   
$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX} can be used in install scripts.
(0039078)
Robert Maynard   
2015-07-08 08:57   
Closing resolved issues that have not been updated in more than 4 months.