Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: use standard CMAKE_INSTALL_INCLUDEDIR for header install folder #753

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

OlivierLDff
Copy link

This gives user control over which folder header should be installed to instead of using hardcoded value include/. Variable CMAKE_INSTALL_INCLUDEDIR is provided after a call to include(GNUInstallDirs)
More info can be found about usage in docs: https://cmake.org/cmake/help/latest/command/install.html

This PR basically replace all $<INSTALL_INTERFACE:include> with $<INSTALL_INTERFACE:include>.


It was already correctly used here:

PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date )

here:
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date )

and here:
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date


This fix a bug if user provide -DCMAKE_INSTALL_INCLUDEDIR=customfolder, right now generated CMake/dateTargets.cmake output a file with:

set_target_properties(date::date PROPERTIES
  INTERFACE_COMPILE_DEFINITIONS "ONLY_C_LOCALE=0"
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_SOURCES "${_IMPORT_PREFIX}/include/date/date.h"
)

With this PR, generated file will be:

set_target_properties(date::date PROPERTIES
  INTERFACE_COMPILE_DEFINITIONS "ONLY_C_LOCALE=0"
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/customfolder"
  INTERFACE_SOURCES "${_IMPORT_PREFIX}/customfolder/date/date.h"
)

…der.

This gives user control over which folder header should be installed to instead of using hardcoded value `include/`.
Variable `CMAKE_INSTALL_INCLUDEDIR` is provided after a call to `include(GNUInstallDirs)`
More info can be found about usage in docs: https://cmake.org/cmake/help/latest/command/install.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants