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

Normalize header install path #467

Merged
merged 3 commits into from
Feb 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions cmake/GzInstallAllHeaders.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -157,31 +157,36 @@ function(gz_install_all_headers)

set(component_name ${gz_install_all_headers_COMPONENT})

# Define the install directory for the component meta header
set(meta_header_install_dir ${GZ_INCLUDE_INSTALL_DIR_FULL}/${PROJECT_INCLUDE_DIR}/${component_name})
# Define the install directory for the "config" header
# The "meta" header will be installed one folder above this
set(config_header_install_dir ${GZ_INCLUDE_INSTALL_DIR_FULL}/${PROJECT_INCLUDE_DIR}/${component_name})

# Define the input/output of the configuration for the component "master" header
set(master_header_in ${GZ_CMAKE_DIR}/gz_auto_headers.hh.in)
set(master_header_out ${CMAKE_CURRENT_BINARY_DIR}/${component_name}.hh)
# Define the input/output of the configuration for the component "meta" header
set(meta_header_in ${GZ_CMAKE_DIR}/gz_auto_headers.hh.in)
set(meta_header_out ${CMAKE_CURRENT_BINARY_DIR}/${component_name}.hh)

else()

# Define the install directory for the core master meta header
set(meta_header_install_dir ${GZ_INCLUDE_INSTALL_DIR_FULL}/${PROJECT_INCLUDE_DIR})
# Define the install directory for the "config" header
# The core "meta" header will be installed one folder above this
set(config_header_install_dir ${GZ_INCLUDE_INSTALL_DIR_FULL}/${PROJECT_INCLUDE_DIR})

# Define the input/output of the configuration for the core "master" header
set(master_header_in ${GZ_CMAKE_DIR}/gz_auto_headers.hh.in)
set(master_header_out ${CMAKE_CURRENT_BINARY_DIR}/../${GZ_DESIGNATION}.hh)
# Define the input/output of the configuration for the core "meta" header
set(meta_header_in ${GZ_CMAKE_DIR}/gz_auto_headers.hh.in)
set(meta_header_out ${CMAKE_CURRENT_BINARY_DIR}/../${GZ_DESIGNATION}.hh)

endif()

# Generate the "master" header that includes all of the headers
configure_file(${master_header_in} ${master_header_out})
# Generate the install directory for the "meta" header one folder above the "config" header
cmake_path(SET meta_header_install_dir NORMALIZE ${config_header_install_dir}/..)

# Install the "master" header
# Generate the "meta" header that includes all of the headers
configure_file(${meta_header_in} ${meta_header_out})

# Install the "meta" header
install(
FILES ${master_header_out}
DESTINATION ${meta_header_install_dir}/..
FILES ${meta_header_out}
DESTINATION ${meta_header_install_dir}
COMPONENT headers)

# Define the input/output of the configuration for the "config" header
Expand All @@ -207,7 +212,7 @@ function(gz_install_all_headers)
# Install the "config" header
install(
FILES ${config_header_out}
DESTINATION ${meta_header_install_dir}
DESTINATION ${config_header_install_dir}
COMPONENT headers)

endif()
Expand Down