robinlinden / libsodium-cmake

Wrapper around the libsodium repository providing good integration with CMake when using FetchContent or adding it as a submodule.
ISC License
33 stars 31 forks source link

All of the .h files in the build are can be removed #5

Open UppaJung opened 4 years ago

UppaJung commented 4 years ago

In a fork of the CMakeLists.txt file used to build the library, I removed all the .h files with no ill effect.

I believe the compiler only needs to know about the .c files to compile, not the headers. This cuts the file size in half and should make it simpler to maintain.

robinlinden commented 4 years ago

I used find -name *.c -or -name *.h libsodium (or something similar) to find all files, so creating the lists isn't a big deal, but I agree that it's pretty cluttered.

The reason for adding them like that is to help some IDEs (Visual Studio) find the headers for autocomplete and things like that.

Depending on the CMake version, generators, and options in libsodium you want to support, you could even use file(GLOB_RECURSE SRCS libsodium/*.c CONFIGURE_DEPENDS) to set the entire build tree up as a one-liner and not have to change it when updating libsodium.

Long-term, I might remove the headers, especially as VS's built-in CMake support gets better, but for now they get to stay since I don't think it's much of a maintenance burden.

robinlinden commented 4 years ago

I've thought some more about it, and I'm not at all attached to having the headers there to support VS. I'll nuke them. 😁 Good suggestion!