conan/CMAKE_INTEGRATION.md
This document describes the integration of Conan packages into TDinternal's CMake build system.
This file has been updated to support the newly created Conan packages:
Location: Lines 33-34
# Testing
if(${BUILD_TEST})
find_package(GTest REQUIRED)
find_package(cppstub REQUIRED) # Header-only stub library for unit tests
endif()
This ensures that when BUILD_TEST is enabled, CMake will find and load the cppstub Conan package.
Location: Lines 447-463
macro(DEP_ext_cppstub tgt)
# cppstub is now available as a Conan package (header-only library)
if(TARGET cppstub::cppstub)
target_link_libraries(${tgt} PUBLIC cppstub::cppstub)
endif()
endmacro()
macro(DEP_ext_cppstub_INC tgt)
# Header-only library, handled by target_link_libraries above
if(TARGET cppstub::cppstub)
target_link_libraries(${tgt} INTERFACE cppstub::cppstub)
endif()
endmacro()
macro(DEP_ext_cppstub_LIB tgt)
# Header-only library, no libs to link
endmacro()
Location: Lines 355-358
Added to the list of successfully migrated dependencies:
# Successfully migrated to Conan:
# - cppstub (testing stub library) - now available as Conan package
# - fast-lzma2 - now available as Conan package
When a test target uses DEP_ext_cppstub(my_test_target), the macro will:
cppstub::cppstub CMake target existstarget_link_libraries# In source/util/test/CMakeLists.txt
add_executable(memPoolTest "memPoolTest.cpp")
DEP_ext_gtest(memPoolTest)
DEP_ext_cppstub(memPoolTest) # Now properly links cppstub headers
target_link_libraries(memPoolTest PRIVATE os util common)
addr_any.h is selected based on OSif(TARGET ...) checks to avoid errorsThe macros maintain the same interface as before:
DEP_ext_cppstub(target) - Main dependency injectionDEP_ext_cppstub_INC(target) - Include paths onlyDEP_ext_cppstub_LIB(target) - Library linking (no-op for header-only)Existing code that uses these macros will work without modification.
conan list "cppstub/*"
Expected output:
Local Cache
cppstub
cppstub/1.0.0
cd build
cmake .. -DBUILD_TEST=true
You should see:
-- Loading Conan dependencies...
-- Found cppstub: 1.0.0
-- All Conan dependencies loaded successfully
cmake --build . --target memPoolTest
The build should succeed without "addr_any.h: No such file or directory" errors.
Solution: Create the cppstub Conan package:
cd conan/cppstub
conan create . --build=missing
Possible causes:
DEP_ext_cppstub not called for the targetBUILD_TEST not enabledSolution: Verify all three conditions are met.
This is normal if cppstub is not available. The if(TARGET ...) check prevents build failures.
conan/cppstub/conanfile.py - Conan recipecmake/conan.cmake - CMake integrationsource/util/test/CMakeLists.txt - Example test targetsource/util/test/memPoolTest.cpp - Example test file using addr_any.h