[CMake] Storing and auto-decrypting sensitive files in cmake SAFELY
	and SANELY
    Gavin Beatty 
    gavinbeatty at gmail.com
       
    Sun Jun 17 12:14:43 EDT 2007
    
    
  
Hello,
Apologies if this is silly/misplaced/misguided.
I'd like a way to automate decrypting (via gpg) a file, installing the
decrypted form and removing the temporary decrypted file from the
cmake dir.
I have tried:
<code>
MACRO(ETC_WPA_INSTALL src)
    EXEC_PROGRAM(gpg
                ARGS        -o ${src} -d "${src}.encrypted"
                )
    INSTALL(FILES           ${src}
            DESTINATION     /etc/wpa_supplicant
            PERMISSIONS     OWNER_READ OWNER_WRITE
            RENAME          wpa_supplicant.conf
            )
    FILE(REMOVE ${src})
ENDMACRO(ETC_WPA_INSTALL src)
</code>
but the INSTALL doesn't actually run until `make install` (as
expected) whereas everything else does. So I get a decrypted file
which is immediately removed when I run `cmake .`! How silly of me
Is there a way to have the decryption as a dependency of install
target and have the removal at the end also?
How would you implement this?
Thanks,
Gavin
PS: Of course, I'll wrap up the gpg call in a FIND_PROGRAM for 1.0 :P
-- 
www.mathsoc.com
    
    
More information about the CMake
mailing list