conan: [bug] Using --profile:build makes private dependencies disappear from CONAN_PKG:: targets
Environment Details (include every applicable attribute)
- Operating System+version: Ubuntu 20.04.2
- Compiler+version: N/A
- Conan version: 1.39.0
- Python version: 3.8.10
Steps to reproduce (Include if Applicable)
Sample project available here
In short:
Add private requirement to the recipe
Build without --profile:build
- builds fine.
Build with --profile:build
- CMake can’t find corresponding CONAN_PKG::target
.
Make requirement public - builds fine.
Logs (Executed commands with output) (Include/Attach if Applicable)
% conan create .
...
libTest/1.0: Created package revision d12aa99fb1d5a5830c83aa3f8aaf1757
% conan create . -pr default
...
libTest/1.0: Created package revision d12aa99fb1d5a5830c83aa3f8aaf1757
% conan create . -pr default -pr:b default
...
-- Configuring done
CMake Error at CMakeLists.txt:7 (add_library):
Target "libTest" links to target "CONAN_PKG::gtest" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
...
CMake Generate step failed. Build files cannot be regenerated correctly.
libTest/1.0:
libTest/1.0: ERROR: Package '54899e12a3af6fe447947590ce807456934636ce' build failed
libTest/1.0: WARN: Build folder /home/paul/.conan/data/libTest/1.0/_/_/build/54899e12a3af6fe447947590ce807456934636ce
ERROR: libTest/1.0: Error in build() method, line 27
cmake.configure(source_folder="src")
ConanException: Error 1 while executing cd '/home/paul/.conan/data/libTest/1.0/_/_/build/54899e12a3af6fe447947590ce807456934636ce' && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCONAN_IN_LOCAL_CACHE="ON" -DCONAN_COMPILER="gcc" -DCONAN_COMPILER_VERSION="9" -DCONAN_CXX_FLAGS="-m64" -DCONAN_SHARED_LINKER_FLAGS="-m64" -DCONAN_C_FLAGS="-m64" -DCONAN_LIBCXX="libstdc++" -DBUILD_SHARED_LIBS="OFF" -DCMAKE_INSTALL_PREFIX="/home/paul/.conan/data/libTest/1.0/_/_/package/54899e12a3af6fe447947590ce807456934636ce" -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_SBINDIR="bin" -DCMAKE_INSTALL_LIBEXECDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" -DCMAKE_INSTALL_OLDINCLUDEDIR="include" -DCMAKE_INSTALL_DATAROOTDIR="share" -DCONAN_CMAKE_POSITION_INDEPENDENT_CODE="ON" -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY="ON" -DCONAN_EXPORTED="1" -Wno-dev '/home/paul/.conan/data/libTest/1.0/_/_/build/54899e12a3af6fe447947590ce807456934636ce/src'
% perl -npe "s#private=True#private=False#" -i conanfile.py
% git diff
diff --git a/conanfile.py b/conanfile.py
index c7feff5..7e3b4ae 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -16,7 +16,7 @@ class LibTestConan(ConanFile):
exports_sources = "src/*"
def requirements(self):
- self.requires("gtest/1.10.0", private=True)
+ self.requires("gtest/1.10.0", private=False)
def config_options(self):
if self.settings.os == "Windows":
% conan create . -pr default -pr:b default
...
libTest/1.0: Created package revision a075cba8e91cc194d7ae6ad6effe3882
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 15 (5 by maintainers)
Yes,
deps_cpp_info
is also deprecated, and the new generators and build system integrations no longer usedeps_cpp_info
nordeps_env_info
, but they use the newself.dependencies
access: https://docs.conan.io/en/latest/reference/conanfile/dependencies.htmlWhen using the 2 profiles,
deps_cpp_info
will no longer contain information from the build context.