0

I have written some C++ libraries and executables in a CMake project. I need to create an installer like a DEB file or an EXE file for them. My issue is that I need to make sure that the only open files are the header files. I need to hide the implementations of the classes and executables. How do I package the software such that the implementations are hidden from the users?

Here are some other sources I have referred to:

https://stackoverflow.com/questions/13144181/how-to-create-an-installer-with-cmake-cpack-nsis-on-windows
https://stackoverflow.com/questions/10086615/cmake-cpack-debian-packages

The CMake cookbook (the book from Packt) goes into packaging software, but I cannot figure out how secure the generated files are from the text.

What is the goal of this encryption? I need to be able to send a header file and a secured compiled file so that the code can be used by somebody without access to the implementation.

robotsfoundme
  • 418
  • 4
  • 18
  • The package will contain the public headers and the compiled binaries, no source files. Are you afraid someone would disassemble your application? – sergej Apr 24 '20 at 06:40
  • Yes, I want to make sure that the application and/or compiled library code is not accessible. Only the header file should readable. Do you know how I would guarantee the desired security? Does the question make sense? – robotsfoundme Apr 24 '20 at 16:47
  • You could create an encrypted zip archive. – sergej Apr 24 '20 at 16:51
  • My follow up would be then, how do you include the binary file in a C++ script? I have seen ".a" files, but, according to my limited understanding of archive files, does not actually hide implementation details. I am also not familiar with encrypted zip archives. I may not have asked my original question correctly. Does this make sense? – robotsfoundme Apr 24 '20 at 16:59
  • There are no C++ **scripts**. C++ source files are compiled to machine code. The compilation hides the implementation details. – sergej Apr 24 '20 at 18:27
  • Well, do you know then how to create an installer, as described in the question @sergej? I am still not able to achieve my end goal. – robotsfoundme Apr 24 '20 at 20:25

1 Answers1

1

You could add a custom action as a post-build process of your executables (please see add_custom_command documentation). In this action, you can do whatever you need e.g., "encrypt" the binary. Then using an ordinal install() the result file gonna be packaged as usual.

zaufi
  • 6,811
  • 26
  • 34