cpp-base64 icon indicating copy to clipboard operation
cpp-base64 copied to clipboard

Add CMake compatibility, cleanup/improve project structure

Open CodeFinder2 opened this issue 3 years ago • 1 comments

Hi,

thanks for this library! :-)

I've added CMake support in order to integrate it in my (CMake) project using CPM.

Along the way, I've also revisited the project's directory structure to more adhere to modern C++ project structures, especially placing headers in include/$name_of_the_project/ to avoid conflicts with equally named headers of other projects (if any).

Would be glad if you could take a look and merge this! :-)

PS: I also updated your Makefile but it fails with

g++ base64-17.o test-17.o -o base64-test-17
base64-test-11
make: base64-test-11: command not found
make: *** [Makefile:30: test] error 127

However, I already got this error before (after just cloning your repo) so it should not be an issue caused by my modifications.

CodeFinder2 avatar Feb 09 '22 12:02 CodeFinder2

Regarding the command not found error, I would update the Makefile as follows:

diff --git a/Makefile b/Makefile
index 126e2ca..0ac27ed 100644
--- a/Makefile
+++ b/Makefile
@@ -27,8 +27,8 @@ WARNINGS=                    \
    -fdiagnostics-show-option

 test: base64-test-11 base64-test-17
-       base64-test-11
-       base64-test-17
+       -./base64-test-11
+       -./base64-test-17

 base64-test-11: base64-11.o test-11.o
        g++ base64-11.o test-11.o -o $@

which instructs the test recipe to run the binaries from the local directory and ignore any returned error, so both tests run

ntwerdochlib avatar Feb 08 '23 00:02 ntwerdochlib