cmake: Modernize exported CMake config files #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The CMake configuration files exported by CommonAPI require users to add the
${COMMONAPI_INCLUDE_DIRS}
variable to their project's include directories. This was done to support building against a build tree of CommonAPI by generating two differentCommonAPIConfig.cmake
files that defined this variable with different values.This is now no longer necessary since CMake supports the
$<BUILD_INTERFACE>
and$<INSTALL_INTERFACE>
generator expressions which can be used to make the same distinction with only a singleCommonAPIConfig.cmake
file.This also allows users of CommonAPI to get the required include directories into their build by using
since the exported CommonAPI CMake target now has the required include directories set as a property. This is much more idiomatic for users of CMake and is thus preferred.
Additionally, this enables downstream projects that build CommonAPI interface libraries to no longer care about what the CommonAPI include directories are, which simplifies writing CMake config files for them.
I've locally compiled vSomeIP, CommonAPI, CommonAPI-SomeIP and a test project using CommonAPI-SomeIP to test this.