conan/cppstub/SUMMARY.md
Successfully created a Conan package for cpp-stub (cppstub), a C++ testing stub library.
conan/cppstub/
├── conanfile.py # Conan recipe
├── README.md # Package documentation
├── SUMMARY.md # This file
├── cppstub/ # Source files
│ ├── LICENSE # MIT License
│ ├── src/
│ │ └── stub.h # Main stub header
│ ├── src_linux/
│ │ └── addr_any.h # Linux-specific header
│ ├── src_darwin/
│ │ └── addr_any.h # macOS-specific header
│ └── src_win/
│ └── addr_any.h # Windows-specific header
└── test_package/ # Test package
├── conanfile.py
├── CMakeLists.txt
└── test_package.cpp
addr_any.h for your OScd /home/huolinhe/Projects/taosdata/TDinternal/community/conan/cppstub
conan create . --build=missing
conan list "cppstub/*"
Expected output:
Local Cache
cppstub
cppstub/1.0.0
[requires]
cppstub/1.0.0
[generators]
CMakeDeps
CMakeToolchain
find_package(cppstub REQUIRED CONFIG)
target_link_libraries(your_target cppstub::cppstub)
#include <stub.h>
#include <addr_any.h>
To integrate this package into the TDinternal build system:
cmake/conan.cmakeReplace the empty DEP_ext_cppstub macro (around line 443):
macro(DEP_ext_cppstub tgt)
if(TARGET cppstub::cppstub)
target_link_libraries(${tgt} PUBLIC cppstub::cppstub)
endif()
endmacro()
Add cppstub as a dependency in the main project's Conan configuration:
def requirements(self):
if self.options.get_safe("build_tests"):
self.requires("cppstub/1.0.0")
Once the above steps are done, uncomment the #include <addr_any.h> lines in:
✅ Package created successfully ✅ Test package built and ran successfully ✅ Headers are accessible ✅ Package installed in local Conan cache
Output from test run:
Testing cppstub package...
Normal add(2, 3) = 5
stub.h header is available
addr_any.h header is available
All tests passed!
Similar to fast-lzma2 package:
Differences:
no_copy_source = True for efficiencypackage_id() clears the info since it's header-only (platform-independent)