Add a PRE_INSTALL option to add_custom_command

Running on macOS (particularly in this case), I need to do some things prior to running the install such as unlocking the keychain (for example), so that the app files I generate can be signed.

Now I do this in the POST_BUILD but that doesn’t get run if I have just done a full build and then run an install as a separate step. Which means I need to do a clean and then install (which forces a build to run first).

Is this likely to materialise (please)?

David

A better alternative may be the add the ability to use:

install(COMMAND command1 [ARGS] [args1...]
        [COMMAND command2 [ARGS] [args2...] ...])

when the COMMAND part has the same syntax as add_custom_command.

David

The install(CODE|SCRIPT) command might be what you’re looking for. You can put execute_process() in the code, for example.

2 Likes

Woohoo!!! (As the saying goes).

Adding:

if(APPLE)
install (CODE “execute_process(COMMAND "$ENV{HOME}/.unlock_keychain")”)
endif()

Did exactly what I needed!

Thank you so much
David

1 Like