Skip to content

Commit

Permalink
Implement Use CMake Header File Sets (#30)
Browse files Browse the repository at this point in the history
* include folder is not working

* fixed include header

* removed unnecessary directives

* update dockerfile to reflect cmake change

* switch to CMAKE_INSTALL_LIBDIR

* remove INSTALL directive

* Revert "remove INSTALL directive"

This reverts commit f4ff6ac.

* update DESTINATION location
  • Loading branch information
wusatosi authored Sep 28, 2024
1 parent 652d49e commit 1ce5d88
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .ci/docker/ubuntu.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# Using a non-LTS Ubuntu, just until CMake 3.23 is available on Ubuntu 24.04.
# Using a non-LTS Ubuntu, just until CMake 3.24 is available on Ubuntu 24.04.
FROM ubuntu:23.10

# Install dependencies,
Expand Down Expand Up @@ -30,5 +30,6 @@ ENV CC="$cc" CXX="$cxx" CMAKE_GENERATOR="Ninja" CMAKE_EXPORT_COMPILE_COMMANDS=on
RUN ls -lR src
RUN cmake -B build -S . "$cmake_args"
RUN cmake --build build --verbose
RUN cmake --build build --target all_verify_interface_header_sets
RUN cmake --install build --prefix /opt/beman.exemplar
RUN find /opt/beman.exemplar -type f
21 changes: 11 additions & 10 deletions src/beman/exemplar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@ add_library(beman::exemplar ALIAS beman.exemplar)

target_sources(beman.exemplar PRIVATE identity.cpp)

target_include_directories(
beman.exemplar
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../../include>)
set(INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../include/)

target_sources(
beman.exemplar PUBLIC
FILE_SET HEADERS
BASE_DIRS ${INCLUDE_DIR}
FILES ${INCLUDE_DIR}/beman/exemplar/identity.hpp)

set_target_properties(beman.exemplar PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON)

install(
TARGETS beman.exemplar
EXPORT beman.exemplar
DESTINATION ${CMAKE_INSTALL_LIBDIR})

install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../../include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING
PATTERN "*.hpp")
FILE_SET HEADERS
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

if(BUILD_TESTING)
include(GoogleTest)
Expand Down

0 comments on commit 1ce5d88

Please sign in to comment.