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: ...@@ -47,13 +47,15 @@ additional_commands:
PROPERTIES: "*" PROPERTIES: "*"
TEST_LIST: "*" TEST_LIST: "*"
DISCOVERY_TIMEOUT: "*" DISCOVERY_TIMEOUT: "*"
setup_target_for_coverage_gcovr_html: target_sources:
pargs: 1
kwargs: kwargs:
BASE_DIRECTORY: "*" INTERFACE:
EXCLUDE: "*" kwargs:
EXECUTABLE: "*" FILE_SET: 1
EXECUTABLE_ARGS: "*" TYPE: 1
DEPENDENCIES: "*" BASE_DIRS: "*"
FILES: "*"
always_wrap: [] always_wrap: []
enable_sort: true enable_sort: true
autosort: false autosort: false
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
# SPDX-License-Identifier: EPL-2.0 # 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 # Add the custom CMake modules to CMake's module path
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
...@@ -75,12 +75,6 @@ CPMAddPackage( ...@@ -75,12 +75,6 @@ CPMAddPackage(
) )
# Add library # Add library
file(
GLOB_RECURSE HEADERS
RELATIVE ${PROJECT_SOURCE_DIR}/include
CONFIGURE_DEPENDS "*.h"
)
add_library(MantleAPI INTERFACE) add_library(MantleAPI INTERFACE)
add_library(MantleAPI::MantleAPI ALIAS MantleAPI) add_library(MantleAPI::MantleAPI ALIAS MantleAPI)
...@@ -95,6 +89,16 @@ target_include_directories( ...@@ -95,6 +89,16 @@ target_include_directories(
target_compile_features(MantleAPI INTERFACE cxx_std_17) 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 # Configure export
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
configure_package_config_file( configure_package_config_file(
...@@ -111,8 +115,11 @@ write_basic_package_version_file( ...@@ -111,8 +115,11 @@ write_basic_package_version_file(
# Configure install # Configure install
if(MantleAPI_INSTALL) if(MantleAPI_INSTALL)
install(DIRECTORY include/ TYPE INCLUDE) install(
install(TARGETS MantleAPI EXPORT MantleAPITargets) TARGETS MantleAPI
EXPORT MantleAPITargets
FILE_SET HEADERS
)
install( install(
EXPORT MantleAPITargets 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