@@ -14,6 +14,12 @@ class StdexecPackage(ConanFile):
1414 license = "Apache 2.0"
1515
1616 settings = "os" , "arch" , "compiler" , "build_type"
17+ options = {
18+ "system_context" : [True , False ],
19+ }
20+ default_options = {
21+ "system_context" : False ,
22+ }
1723 exports_sources = (
1824 "include/*" ,
1925 "src/*" ,
@@ -24,6 +30,12 @@ class StdexecPackage(ConanFile):
2430 )
2531 generators = "CMakeToolchain"
2632
33+ def configure (self ):
34+ if self .options .system_context :
35+ self .package_type = "static-library"
36+ else :
37+ self .package_type = "header-library"
38+
2739 def validate (self ):
2840 check_min_cppstd (self , "20" )
2941
@@ -37,18 +49,21 @@ def layout(self):
3749
3850 def build (self ):
3951 tests = "OFF" if self .conf .get ("tools.build:skip_test" , default = False ) else "ON"
52+ system_context = "ON" if self .options .system_context else "OFF"
4053
4154 cmake = CMake (self )
4255 cmake .configure (variables = {
4356 "STDEXEC_BUILD_TESTS" : tests ,
4457 "STDEXEC_BUILD_EXAMPLES" : tests ,
58+ "STDEXEC_BUILD_SYSTEM_CONTEXT" : system_context ,
4559 })
4660 cmake .build ()
4761 cmake .test ()
4862
4963 def package_id (self ):
50- # Clear settings because this package is header-only.
51- self .info .clear ()
64+ if not self .info .options .system_context :
65+ # Clear settings because this package is header-only.
66+ self .info .clear ()
5267
5368 def package (self ):
5469 cmake = CMake (self )
@@ -58,4 +73,8 @@ def package_info(self):
5873 self .cpp_info .set_property ("cmake_file_name" , "P2300" )
5974 self .cpp_info .set_property ("cmake_target_name" , "P2300::P2300" )
6075 self .cpp_info .set_property ("cmake_target_aliases" , ["STDEXEC::stdexec" ])
61- self .cpp_info .libs = ["system_context" ]
76+ if self .options .system_context :
77+ self .cpp_info .components ["system_context" ].libs = ["system_context" ]
78+ self .cpp_info .components ["system_context" ].set_property (
79+ "cmake_target_name" , "STDEXEC::system_context"
80+ )
0 commit comments