Skip to content
Snippets Groups Projects
Verified Commit 58e408dd authored by Martin Stump's avatar Martin Stump
Browse files

Add compile_commands.json entries for headers


* Add headers to the HEADERS file set
* Verify the HEADERS file set
  * This property will generate a translation unit for each header and check if it can be compiled
  * This in turn will generate entries for these translation units
* Raise minimum CMake version to 3.24.0 for property VERIFY_INTERFACE_HEADER_SETS

Signed-off-by: default avatarMartin Stump <martin.stump@mercedes-benz.com>
parent 0e80917f
No related branches found
No related tags found
No related merge requests found
......@@ -47,13 +47,15 @@ additional_commands:
PROPERTIES: "*"
TEST_LIST: "*"
DISCOVERY_TIMEOUT: "*"
setup_target_for_coverage_gcovr_html:
target_sources:
pargs: 1
kwargs:
BASE_DIRECTORY: "*"
EXCLUDE: "*"
EXECUTABLE: "*"
EXECUTABLE_ARGS: "*"
DEPENDENCIES: "*"
INTERFACE:
kwargs:
FILE_SET: 1
TYPE: 1
BASE_DIRS: "*"
FILES: "*"
always_wrap: []
enable_sort: true
autosort: false
......
......@@ -9,7 +9,7 @@
# SPDX-License-Identifier: EPL-2.0
################################################################################
cmake_minimum_required(VERSION 3.15.0 FATAL_ERROR)
cmake_minimum_required(VERSION 3.24.0 FATAL_ERROR)
# Add the custom CMake modules to CMake's module path
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
......@@ -75,12 +75,6 @@ CPMAddPackage(
)
# Add library
file(
GLOB_RECURSE HEADERS
RELATIVE ${PROJECT_SOURCE_DIR}/include
CONFIGURE_DEPENDS "*.h"
)
add_library(MantleAPI INTERFACE)
add_library(MantleAPI::MantleAPI ALIAS MantleAPI)
......@@ -95,6 +89,16 @@ target_include_directories(
target_compile_features(MantleAPI INTERFACE cxx_std_17)
file(GLOB_RECURSE HEADERS CONFIGURE_DEPENDS "include/**/*.h")
target_sources(
MantleAPI
INTERFACE FILE_SET HEADERS
TYPE HEADERS
BASE_DIRS $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
FILES ${HEADERS}
)
set_target_properties(MantleAPI PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON)
# Configure export
include(CMakePackageConfigHelpers)
configure_package_config_file(
......@@ -111,8 +115,11 @@ write_basic_package_version_file(
# Configure install
if(MantleAPI_INSTALL)
install(DIRECTORY include/ TYPE INCLUDE)
install(TARGETS MantleAPI EXPORT MantleAPITargets)
install(
TARGETS MantleAPI
EXPORT MantleAPITargets
FILE_SET HEADERS
)
install(
EXPORT MantleAPITargets
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment