From 5d9e08a52e2b9d5492386537ba273955c468bcfe Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 23 Apr 2023 19:26:58 -0700 Subject: [PATCH] Add an option to disable installing headers of a binary component This can be used with a separate install component to control which headers are installed. --- source/lib/binarycomponent.cpp | 7 ++++--- source/lib/binarycomponent.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/source/lib/binarycomponent.cpp b/source/lib/binarycomponent.cpp index 408ea46..d13a860 100644 --- a/source/lib/binarycomponent.cpp +++ b/source/lib/binarycomponent.cpp @@ -87,7 +87,7 @@ void BinaryComponent::create_targets() const if(tool->accepts_suffix(ext)) { t = &dynamic_cast(*tool->create_target(*t)); - if(type==LIBRARY) + if(type==LIBRARY && install_headers) create_install(*t); } } @@ -98,7 +98,7 @@ void BinaryComponent::create_targets() const vector group = extract_group(pending, *tool); FileTarget &tgt = dynamic_cast(*tool->create_target(group)); pending.push_back(&tgt); - if(type==LIBRARY) + if(type==LIBRARY && install_headers) create_install(tgt); } } @@ -151,7 +151,7 @@ vector BinaryComponent::create_sources() const if(FileTarget *file = dynamic_cast(src)) { targets.push_back(file); - if(type==LIBRARY) + if(type==LIBRARY && install_headers) create_install(*file); } } @@ -199,6 +199,7 @@ void BinaryComponent::create_install(FileTarget &target) const BinaryComponent::Loader::Loader(BinaryComponent &c): DataFile::DerivedObjectLoader(c) { + add("install_headers", &BinaryComponent::install_headers); add("use", &Loader::use); } diff --git a/source/lib/binarycomponent.h b/source/lib/binarycomponent.h index c7abe57..d5c9ab2 100644 --- a/source/lib/binarycomponent.h +++ b/source/lib/binarycomponent.h @@ -29,6 +29,7 @@ public: private: Type type; std::vector uses; + bool install_headers = true; public: BinaryComponent(SourcePackage &p, const std::string &n, Type t): Component(p, n), type(t) { } -- 2.45.2