[CMake] Ignore installation failure

David Adam zanchey at ucc.gu.uwa.edu.au
Sun Feb 18 00:17:34 EST 2018


Hi there,

Our project installs an empty directory for other programs to drop files 
in, the location of which is overrideable with a cache variable. Some 
environments set the location of this directory outside the writeable 
area and create it themselves, so I'd like to set up CMake so that it 
tries to create the directory but skips over it if there is a failure.

At the moment we use:

SET(extra_completionsdir
    ${rel_datadir}/fish/vendor_completions.d
    CACHE STRING "Path for extra completions")
INSTALL(DIRECTORY DESTINATION ${extra_completionsdir})

but that fails if the destination is not writeable.

Is there an idiomatic way of ignoring a failed installation step? At the 
moment, I'm trying various install(script code execute_process(... 
incantations, but I'm aware there's lots of corner cases with DESTDIR and 
so on.

Thanks

David Adam
zanchey at ucc.gu.uwa.edu.au


More information about the CMake mailing list