Skip to content

Commit 3ad7b94

Browse files
authored
flac: add option to disable building C++ libraries (#28739)
Not everyone needs these, and since BUILD_CXXLIBS already exists in CMake, let's expose it in Conan too.
1 parent 7924a15 commit 3ad7b94

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

recipes/flac/all/conanfile.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ class FlacConan(ConanFile):
2121
options = {
2222
"shared": [True, False],
2323
"fPIC": [True, False],
24+
"with_cxxlibs": [True, False],
2425
}
2526
default_options = {
2627
"shared": False,
2728
"fPIC": True,
29+
"with_cxxlibs": True,
2830
}
2931

3032
def export_sources(self):
@@ -58,6 +60,7 @@ def generate(self):
5860
tc.variables["BUILD_DOCS"] = False
5961
tc.variables["BUILD_PROGRAMS"] = not is_apple_os(self) or self.settings.os == "Macos"
6062
tc.variables["BUILD_TESTING"] = False
63+
tc.variables["BUILD_CXXLIBS"] = self.options.with_cxxlibs
6164
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW"
6265
if Version(self.version) < "1.3.4":
6366
tc.cache_variables["CMAKE_POLICY_VERSION_MINIMUM"] = "3.5" # CMake 4 support
@@ -100,10 +103,11 @@ def package_info(self):
100103
self.cpp_info.components["libflac"].libs = ["FLAC"]
101104
self.cpp_info.components["libflac"].requires = ["ogg::ogg"]
102105

103-
self.cpp_info.components["libflac++"].set_property("cmake_target_name", "FLAC::FLAC++")
104-
self.cpp_info.components["libflac++"].set_property("pkg_config_name", "flac++")
105-
self.cpp_info.components["libflac++"].libs = ["FLAC++"]
106-
self.cpp_info.components["libflac++"].requires = ["libflac"]
106+
if self.options.with_cxxlibs:
107+
self.cpp_info.components["libflac++"].set_property("cmake_target_name", "FLAC::FLAC++")
108+
self.cpp_info.components["libflac++"].set_property("pkg_config_name", "flac++")
109+
self.cpp_info.components["libflac++"].libs = ["FLAC++"]
110+
self.cpp_info.components["libflac++"].requires = ["libflac"]
107111
if not self.options.shared:
108112
self.cpp_info.components["libflac"].defines = ["FLAC__NO_DLL"]
109113
if self.settings.os in ["Linux", "FreeBSD"]:

0 commit comments

Comments
 (0)