Create a directory for internal headers
Currently, users of clad do not need to have access to all the header files defined in include/clad/Differentiator. We should create a separate directory for internal headers, this directory should contain all the headers that are not required by the users.
Hello @parth-07 @vgvassilev
To solve this issue, we can create a new directory named "internal" under "include/clad/Differentiator" and move all the internal headers to this new directory. This will make it clear which headers are intended for internal use only and which headers are part of the public interface.
Here are the steps to implement this solution:
- Create a new directory named
internalunderinclude/clad/Differentiator:
mkdir include/clad/Differentiator/internal
- Move all the internal headers to this new directory:
mv include/clad/Differentiator/*_impl.h include/clad/Differentiator/internal/
- Update the
CMakeLists.txtfile to exclude the internal headers from the installation targets:
file(GLOB_RECURSE public_headers "${PROJECT_SOURCE_DIR}/include/*.h")
file(GLOB_RECURSE internal_headers "${PROJECT_SOURCE_DIR}/include/clad/Differentiator/internal/*.h")
# Install public headers
install(FILES ${public_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
# Do not install internal headers
set(CMAKE_INSTALL_INCLUDEDIR_INTERNAL "${CMAKE_INSTALL_INCLUDEDIR}/clad/Differentiator/internal")
install(FILES ${internal_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR_INTERNAL} OPTIONAL)
- Update the include statements in the public headers to reflect the new directory structure:
#include "clad/Differentiator/internal/SomeInternalHeader.h"
May be with these changes, the internal headers will be separated from the public headers, and users of clad will not need to have access to all the header files defined in include/clad/Differentiator.