[question] Installing an executable with its dependencies through CMake with the new CMakeConfigDeps
What is your question?
Hello !
Although I am well aware deployers exist to install components coming from another conan package, I would like to able to do so from a pure CMake way
In fact, I try to leverage ctest in order to run cmake install and copy the desired components (executables) and their dependencies to the required location, before running the tests
I am trying with the new CMakeConfigDeps to be able to reach the executables through the targets, but that does not seem to be enough:
...
find_package(MyTarget)
get_target_property(WRAPPERGEN_EXEC MyTarget::wrappergenerator LOCATION) # The var is properly populated
add_executable(wrappergenerator IMPORTED GLOBAL)
set_property(TARGET wrappergenerator PROPERTY
IMPORTED_LOCATION "${WRAPPERGEN_EXEC}")
install(RUNTIME_DEPENDENCY_SET my_app_deps
PRE_EXCLUDE_REGEXES
[=[api-ms-]=] # VC Redistibutable DLLs
[=[ext-ms-]=] # Windows extension DLLs
# [=[python]=]
[[kernel32\.dll]] # Default in conan doc
[[libc\.so\..*]] [[libgcc_s\.so\..*]] [[libm\.so\..*]] [[libstdc\+\+\.so\..*]] # Default in conan doc
POST_EXCLUDE_REGEXES
[=[.*system32\/.*\.dll]=] # Windows system DLLs
[=[^\/(lib*|usr\/lib*|usr\/local\/lib*\/lib64)]=] # Unix system libraries
DIRECTORIES
${CONAN_RUNTIME_LIB_DIRS}
install(TARGETS wrappergenerator
RUNTIME_DEPENDENCY_SET my_app_deps
RUNTIME
DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
While I could simply run install(FILES ${WRAPPERGEN_EXEC} ..., that would not allow accessing the deps of the executable, would it?
In the end, would it be possible to add some more documentation regarding these scenarios? Whether it concerns executables or libraries? Thank you very much for your work.
Have you read the CONTRIBUTING guide?
- [x] I've read the CONTRIBUTING guide
Hi @Todiq
Thanks for your question.
What is exactly failing to work there? It is not clear how it doesn't work, maybe the best would be to provide a minimal reproducible example so we can reproduce on our end and investigate.
There is no extensive documentation for this in the Conan side, because at the end of the day it is mostly just a CONAN_RUNTIME_LIB_DIRS variable containing the paths to the different locations to the shared libraries. Maybe the first thing to check would be to check the Conan generated files conan_toolchain.cmake and see the value of this variable, and check the paths if they contain the expected shared libraries. If that is the case, then there might be something in the CMake side.
Hello @memsharded,
Thank you. It looks like I mixed several things.
I created a minimal reproducible case here : https://github.com/Todiq/test_conan
- After running
python build.py, and try installing the project withcmake --install ...,alphawill indeed get installed.
However, it looks like there is no way to install its dependencies.
In fact the dependency set created by this block:
install(RUNTIME_DEPENDENCY_SET my_app_deps
...
)
Is only usable for local targets, thus won't work with Alpha::alpha, which is imported. CMake limitation there, I don't think conan can work around this.
However, while the LOCATION property of Alpha::alpha is set, some others could be very useful.
Thanks to LINK_LIBRARIES one would be able to run the following code, which installs all the deps:
find_package(test_alpha QUIET)
get_target_property(alpha_libs Alpha::alpha LINK_LIBRARIES)
foreach(lib ${alpha_libs})
get_target_property(lib_path ${lib} LOCATION)
if(lib_path)
install(FILES ${lib_path} DESTINATION lib)
endif()
endforeach()
While I presume this could be done through cpp_info.set_property, I am wondering if conan could detect those automatically, based off the cpp_info.requires field
- Second thing : editable mode. If instead of running a
conan createon alpha, I set is an editable and build it, I am not able to run acmake installon beta anymore. It looks likecpp_info.exeandcpp_info.locationtake precedence over thelayout()method, thus failing to locate the built exe.
Could you please give me a hand? Thanks in advance
Thanks for the feedback. I am having a look at the first part.
Indeed, the
get_target_property(alpha_libs Alpha::alpha LINK_LIBRARIES)
won't return the results, because the IMPORTED executable target didn't declare such libraries.
The main problem with this is that this would require a proper definition of the .requires field, which is not really necessary for the normal operation, so this will be very unlikely to be filled correctly by users.
But even though, even if it was defined, I have just tested this in a pure CMake project, using the standard CMake built-in export and config.cmake generation functionality, and CMake doesn't seem to be adding this LINK_LIBRARIES property to the IMPORTED executables, so it seems this wouldn't be a recommended approach.
I updated the code.
It looks like this block should in theory be able to install an external target and its dependencies:
install(
IMPORTED_RUNTIME_ARTIFACTS
Alpha::alpha
RUNTIME_DEPENDENCY_SET
my_app_deps
)
install(RUNTIME_DEPENDENCY_SET my_app_deps
PRE_EXCLUDE_REGEXES
[=[api-ms-]=]
[=[ext-ms-]=]
[[kernel32\.dll]]
[[libc\.so\..*]] [[libgcc_s\.so\..*]] [[libm\.so\..*]] [[libstdc\+\+\.so\..*]]
POST_EXCLUDE_REGEXES
[=[.*system32\/.*\.dll]=]
[=[^\/(lib|usr\/lib|usr\/local\/lib\/lib64)]=]
DIRECTORIES
${CONAN_RUNTIME_LIB_DIRS}
)
But only installs the exe. However, this one does and successfully retrieves the python interpreter (wrongly gets the symlink on linux, but does not matter here) and its dependencies:
install(
IMPORTED_RUNTIME_ARTIFACTS
Alpha::alpha
Python3::Interpreter
RUNTIME_DEPENDENCY_SET
my_app_deps
)
install(RUNTIME_DEPENDENCY_SET my_app_deps
PRE_EXCLUDE_REGEXES
[=[api-ms-]=]
[=[ext-ms-]=]
[[kernel32\.dll]]
[[libc\.so\..*]] [[libgcc_s\.so\..*]] [[libm\.so\..*]] [[libstdc\+\+\.so\..*]]
POST_EXCLUDE_REGEXES
[=[.*system32\/.*\.dll]=]
# [=[^\/(lib|usr\/lib|usr\/local\/lib\/lib64)]=]
DIRECTORIES
${CONAN_RUNTIME_LIB_DIRS}
)
It even successfully finds zlib and install it as it is indeed required by Alpha::alpha (ldd on python reveals no link to it), but gets the system one instead of the conan one!
I dont know if imported targets like Alpha::alpha could be set to only look in the conan cache
I am doing the following test:
def test_runtime_lib_dirs_install(self):
client = TestClient(path_with_spaces=False)
client.run("new cmake_lib -d name=liba -d version=1.0 -o=liba")
client.run("create liba -o *:shared=True -tf=")
client.run("new cmake_lib -d name=libb -d version=1.0 -d requires=liba/1.0 -o libb")
client.run("create libb -o *:shared=True -tf=")
client.run("new cmake_exe -d name=app -d requires=libb/1.0 -o app")
app = textwrap.dedent(f"""
import os, platform
from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout
class Recipe(ConanFile):
name = "app"
version = "1.0"
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps", "CMakeToolchain"
package_type = "application"
exports_sources = "CMakeLists.txt", "src/*"
requires = "libb/1.0"
def layout(self):
cmake_layout(self)
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
cmake = CMake(self)
cmake.install()
def package_info(self):
self.cpp_info.exe = "app"
name = "app.exe" if platform.system() == "Windows" else "app"
self.cpp_info.location = os.path.join("bin", name)
""")
client.save({"app/conanfile.py": app})
client.run("create app -o *:shared=True")
cmake = textwrap.dedent("""
cmake_minimum_required(VERSION 3.15)
project(myproject CXX)
find_package(app)
message(STATUS "CONAN_RUNTIME_LIB_DIRS=${CONAN_RUNTIME_LIB_DIRS}")
install(
IMPORTED_RUNTIME_ARTIFACTS
app::app
RUNTIME_DEPENDENCY_SET
my_app_deps
)
install(RUNTIME_DEPENDENCY_SET my_app_deps
PRE_EXCLUDE_REGEXES
[=[api-ms-]=]
[=[ext-ms-]=]
[[kernel32\.dll]]
[[libc\.so\..*]] [[libgcc_s\.so\..*]] [[libm\.so\..*]] [[libstdc\+\+\.so\..*]]
POST_EXCLUDE_REGEXES
[=[.*system32\/.*\.dll]=]
[=[^\/(lib|usr\/lib|usr\/local\/lib\/lib64)]=]
DIRECTORIES
${CONAN_RUNTIME_LIB_DIRS}
)
""")
conanfile = textwrap.dedent("""
from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout
class Recipe(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps", "CMakeToolchain"
requires = "app/1.0"
def layout(self):
cmake_layout(self)
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
cmake.install()
""")
client.save({"conanfile.py": conanfile,
"CMakeLists.txt": cmake}, clean_first=True)
client.run(f"build . -o *:shared=True -c tools.cmake.cmakedeps:new={new_value}")
print(client.out)
I have tested so far in Windows, and it seems to work, it install the application and the transitive shared libraries:
-- Installing: T:/tmp9s5bpgwpconans/pathwithoutspaces/bin/app.exe
-- Installing: T:/tmp9s5bpgwpconans/pathwithoutspaces/bin/liba.dll
-- Installing: T:/tmp9s5bpgwpconans/pathwithoutspaces/bin/libb.dll
Hi @Todiq
Any feedback about the above? It seems to be working from my side
Hello @memsharded,
I can't make it work. When I run the last command, it stops abruptly when reaching the build() method
conan build . -o "*:shared=True" -c tools.cmake.cmakedeps:new=will_break_next -pr:a msvc -vvv
======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=17
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
[options]
*:shared=True
[conf]
tools.cmake.cmake_layout:build_folder_vars=['settings.os', 'settings.compiler', 'settings.compiler.version', 'settings.arch']
tools.cmake.cmakedeps:new=will_break_next
tools.cmake.cmaketoolchain:generator=Ninja Multi-Config
tools.env.virtualenv:powershell=powershell
Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=17
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
[conf]
tools.cmake.cmake_layout:build_folder_vars=['settings.os', 'settings.compiler', 'settings.compiler.version', 'settings.arch']
tools.cmake.cmakedeps:new=will_break_next
tools.cmake.cmaketoolchain:generator=Ninja Multi-Config
tools.env.virtualenv:powershell=powershell
======== Computing dependency graph ========
Graph root
conanfile.py: C:\Users\Todiq\Documents\test\conanfile.py
Requirements
app/1.0#622b7c64f9ea1e40b331659fbbd18b23 - Cache
liba/1.0#55fa708262552dbd4d2f6cd5ea530b65 - Cache
libb/1.0#a5a6f08eecb73dc7e0eae78eec677c19 - Cache
======== Computing necessary packages ========
Requirements
app/1.0#622b7c64f9ea1e40b331659fbbd18b23:082e26684b6e4235ed2bac899aa32f4c3afd007d#19b34c7b46c4544a00bbaecae9d7c5ae - Cache
settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
requires: libb/1.0.Z
liba/1.0#55fa708262552dbd4d2f6cd5ea530b65:96b926a9076222d94071f3c1b1f5269cc834337a#6871e3272baaf3c20fc299809d3995c4 - Cache
settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
options: shared=True
libb/1.0#a5a6f08eecb73dc7e0eae78eec677c19:f695a0dddfbeca97f0f05be9b4d1221815357a3a#8e37e913e152841ca4d0321a7e64b2cb - Cache
settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
options: shared=True
requires: liba/1.0.Z
======== Installing packages ========
liba/1.0: Already installed! (1 of 3)
libb/1.0: Already installed! (2 of 3)
app/1.0: Already installed! (3 of 3)
======== Finalizing install (deploy, generators) ========
conanfile.py: Writing generators to C:\Users\Todiq\Documents\test
conanfile.py: WARN: Using the new CMakeConfigDeps generator, behind the 'tools.cmake.cmakedeps:new' gate conf. This conf will change next release, breaking, so use it only for testing and dev
conanfile.py: Generator 'CMakeDeps' calling 'generate()'
conanfile.py: CMakeDeps necessary find_package() and targets for your CMakeLists.txt
find_package(app)
conanfile.py: Generator 'CMakeToolchain' calling 'generate()'
conanfile.py: CMakeToolchain generated: conan_toolchain.cmake
conanfile.py: CMakeToolchain: Preset 'conan-windows-msvc-194-x86_64' added to CMakePresets.json.
(cmake>=3.23) cmake --preset conan-windows-msvc-194-x86_64
(cmake<3.23) cmake <path> -G "Ninja Multi-Config" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl
conanfile.py: CMakeToolchain generated: C:\Users\Todiq\Documents\test\CMakePresets.json
conanfile.py: Generating aggregated env files
conanfile.py: Generated aggregated env files: ['conanbuild.bat', 'conanbuild.ps1', 'conanrun.ps1']
======== Calling build() ========
Is the above failing with the same new cmake_lib -d name=liba -d version=1.0 -o=liba Conan default templates?
A couple of things to try:
- Try removing the
powershellconf, and running in a regularcmdterminal - Try removing the
Ninja Multi-Configgenerator, use the default one
Sorry, I must have made an error somewhere, but can't find which one. Here is the full log
Logs
Click to expand log
(venv) C:\Users\Todiq\AppData\Local\Temp>conan version
version: 2.17.0
conan_path: C:\Users\Todiq\Documents\venv\Scripts\conan
python
version: 3.9.13
sys_version: 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)]
sys_executable: C:\Users\Todiq\Documents\venv\Scripts\python.exe
is_frozen: False
architecture: AMD64
system
version: 10.0.26100
platform: Windows-10-10.0.26100-SP0
system: Windows
release: 10
cpu: Intel64 Family 6 Model 186 Stepping 3, GenuineIntel
(venv) C:\Users\Todiq\AppData\Local\Temp>conan profile detect
detect_api: Found msvc 17
Detected profile:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.version=194
os=Windows
WARN: This profile is a guess of your environment, please check it.
WARN: The output of this command is not guaranteed to be stable and can change in future Conan versions.
WARN: Use your own profile files for stability.
Saving detected profile to C:\Users\Todiq\AppData\Local\Temp\conan\profiles\default
(venv) C:\Users\Todiq\AppData\Local\Temp>conan new cmake_lib -d "name=liba" -d "version=1.0" -o "liba"
File saved: CMakeLists.txt
File saved: conanfile.py
File saved: include/liba.h
File saved: src/liba.cpp
File saved: test_package/CMakeLists.txt
File saved: test_package/conanfile.py
File saved: test_package/src/example.cpp
(venv) C:\Users\Todiq\AppData\Local\Temp>conan create liba -o "*:shared=True" -tf=""
======== Exporting recipe to the cache ========
liba/1.0: Exporting package recipe: C:\Users\Todiq\AppData\Local\Temp\liba\conanfile.py
liba/1.0: Copied 1 '.py' file: conanfile.py
liba/1.0: Copied 1 '.txt' file: CMakeLists.txt
liba/1.0: Copied 1 '.h' file: liba.h
liba/1.0: Copied 1 '.cpp' file: liba.cpp
liba/1.0: Exported to cache folder: C:\Users\Todiq\AppData\Local\Temp\conan\p\libab473396c51eff\e
liba/1.0: Exported: liba/1.0#0fbf481ef3fd42eb7fe3a14079aa6d3a (2025-06-17 12:25:32 UTC)
======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
[options]
*:shared=True
Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
======== Computing dependency graph ========
Graph root
cli
Requirements
liba/1.0#0fbf481ef3fd42eb7fe3a14079aa6d3a - Cache
======== Computing necessary packages ========
liba/1.0: Forced build from source
Requirements
liba/1.0#0fbf481ef3fd42eb7fe3a14079aa6d3a:a818caff19c116dafdc2337a9b30675bd75e8985 - Build
======== Installing packages ========
-------- Installing package liba/1.0 (1 of 1) --------
liba/1.0: Building from source
liba/1.0: Package liba/1.0:a818caff19c116dafdc2337a9b30675bd75e8985
liba/1.0: settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=14 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
liba/1.0: options: shared=True
liba/1.0: Copying sources to build folder
liba/1.0: Building your package in C:\Users\Todiq\AppData\Local\Temp\conan\p\b\liba5c46f5283f33a\b
liba/1.0: Calling generate()
liba/1.0: Generators folder: C:\Users\Todiq\AppData\Local\Temp\conan\p\b\liba5c46f5283f33a\b\build\generators
liba/1.0: CMakeToolchain generated: conan_toolchain.cmake
liba/1.0: CMakeToolchain generated: C:\Users\Todiq\AppData\Local\Temp\conan\p\b\liba5c46f5283f33a\b\build\generators\CMakePresets.json
liba/1.0: CMakeToolchain generated: C:\Users\Todiq\AppData\Local\Temp\conan\p\b\liba5c46f5283f33a\b\CMakeUserPresets.json
liba/1.0: Generating aggregated env files
liba/1.0: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
liba/1.0: Calling build()
liba/1.0: Running CMake.configure()
liba/1.0: RUN: cmake -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="C:/Users/Todiq/AppData/Local/Temp/conan/p/b/liba5c46f5283f33a/p" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" "C:/Users/Todiq/AppData/Local/Temp/conan/p/b/liba5c46f5283f33a/b"
-- Using Conan toolchain: C:/Users/Todiq/AppData/Local/Temp/conan/p/b/liba5c46f5283f33a/b/build/generators/conan_toolchain.cmake
-- Conan toolchain: CMAKE_GENERATOR_TOOLSET=v143
-- Conan toolchain: Setting CMAKE_MSVC_RUNTIME_LIBRARY=$<$<CONFIG:Release>:MultiThreadedDLL>
-- Conan toolchain: C++ Standard 14 with extensions OFF
-- Conan toolchain: Setting BUILD_SHARED_LIBS = ON
-- The CXX compiler identification is MSVC 19.44.35207.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (2.2s)
-- Generating done (0.0s)
-- Build files have been written to: C:/Users/Todiq/AppData/Local/Temp/conan/p/b/liba5c46f5283f33a/b/build
liba/1.0: Running CMake.build()
liba/1.0: RUN: cmake --build "C:\Users\Todiq\AppData\Local\Temp\conan\p\b\liba5c46f5283f33a\b\build" --config Release
Version MSBuild 17.14.8+a7a4d5af0 pour .NET Framework
C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(548,5): warning MSB8
029: Le répertoire intermédiaire ou le répertoire de sortie ne peut pas se trouver sous le répertoire temporaire car cela risque de
créer des problèmes avec la génération incrémentielle. [C:\Users\Todiq\AppData\Local\Temp\conan\p\b\liba5c46f5283f33a\b\build\ZER
O_CHECK.vcxproj]
1>Checking Build System
C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(548,5): warning MSB8
029: Le répertoire intermédiaire ou le répertoire de sortie ne peut pas se trouver sous le répertoire temporaire car cela risque de
créer des problèmes avec la génération incrémentielle. [C:\Users\Todiq\AppData\Local\Temp\conan\p\b\liba5c46f5283f33a\b\build\lib
a.vcxproj]
Building Custom Rule C:/Users/Todiq/AppData/Local/Temp/conan/p/b/liba5c46f5283f33a/b/CMakeLists.txt
liba.cpp
Création de la bibliothèque C:/Users/Todiq/AppData/Local/Temp/conan/p/b/liba5c46f5283f33a/b/build/Release/liba.lib et de l'o
bjet C:/Users/Todiq/AppData/Local/Temp/conan/p/b/liba5c46f5283f33a/b/build/Release/liba.exp
liba.vcxproj -> C:\Users\Todiq\AppData\Local\Temp\conan\p\b\liba5c46f5283f33a\b\build\Release\liba.dll
C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(548,5): warning MSB8
029: Le répertoire intermédiaire ou le répertoire de sortie ne peut pas se trouver sous le répertoire temporaire car cela risque de
créer des problèmes avec la génération incrémentielle. [C:\Users\Todiq\AppData\Local\Temp\conan\p\b\liba5c46f5283f33a\b\build\ALL
_BUILD.vcxproj]
Building Custom Rule C:/Users/Todiq/AppData/Local/Temp/conan/p/b/liba5c46f5283f33a/b/CMakeLists.txt
liba/1.0: Package 'a818caff19c116dafdc2337a9b30675bd75e8985' built
liba/1.0: Build folder C:\Users\Todiq\AppData\Local\Temp\conan\p\b\liba5c46f5283f33a\b\build
liba/1.0: Generating the package
liba/1.0: Packaging in folder C:\Users\Todiq\AppData\Local\Temp\conan\p\b\liba5c46f5283f33a\p
liba/1.0: Calling package()
liba/1.0: Running CMake.install()
liba/1.0: RUN: cmake --install "C:\Users\Todiq\AppData\Local\Temp\conan\p\b\liba5c46f5283f33a\b\build" --config Release --prefix "C:/Users/Todiq/AppData/Local/Temp/conan/p/b/liba5c46f5283f33a/p"
-- Installing: C:/Users/Todiq/AppData/Local/Temp/conan/p/b/liba5c46f5283f33a/p/lib/liba.lib
-- Installing: C:/Users/Todiq/AppData/Local/Temp/conan/p/b/liba5c46f5283f33a/p/bin/liba.dll
-- Installing: C:/Users/Todiq/AppData/Local/Temp/conan/p/b/liba5c46f5283f33a/p/include/liba.h
liba/1.0: package(): Packaged 1 '.dll' file: liba.dll
liba/1.0: package(): Packaged 1 '.h' file: liba.h
liba/1.0: package(): Packaged 1 '.lib' file: liba.lib
liba/1.0: Created package revision 0869d12165cd20d41b0d942057c169af
liba/1.0: Package 'a818caff19c116dafdc2337a9b30675bd75e8985' created
liba/1.0: Full package reference: liba/1.0#0fbf481ef3fd42eb7fe3a14079aa6d3a:a818caff19c116dafdc2337a9b30675bd75e8985#0869d12165cd20d41b0d942057c169af
liba/1.0: Package folder C:\Users\Todiq\AppData\Local\Temp\conan\p\b\liba5c46f5283f33a\p
(venv) C:\Users\Todiq\AppData\Local\Temp>conan new cmake_lib -d "name=libb" -d "version=1.0" -d "requires=liba/1.0" -o "libb"
File saved: CMakeLists.txt
File saved: conanfile.py
File saved: include/libb.h
File saved: src/libb.cpp
File saved: test_package/CMakeLists.txt
File saved: test_package/conanfile.py
File saved: test_package/src/example.cpp
(venv) C:\Users\Todiq\AppData\Local\Temp>conan create libb -o "*:shared=True" -tf=""
======== Exporting recipe to the cache ========
libb/1.0: Exporting package recipe: C:\Users\Todiq\AppData\Local\Temp\libb\conanfile.py
libb/1.0: Copied 1 '.py' file: conanfile.py
libb/1.0: Copied 1 '.txt' file: CMakeLists.txt
libb/1.0: Copied 1 '.h' file: libb.h
libb/1.0: Copied 1 '.cpp' file: libb.cpp
libb/1.0: Exported to cache folder: C:\Users\Todiq\AppData\Local\Temp\conan\p\libbadc31f1c6b84e\e
libb/1.0: Exported: libb/1.0#63571d919743c4cbc1e293cdbd8c3b01 (2025-06-17 12:25:46 UTC)
======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
[options]
*:shared=True
Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
======== Computing dependency graph ========
Graph root
cli
Requirements
liba/1.0#0fbf481ef3fd42eb7fe3a14079aa6d3a - Cache
libb/1.0#63571d919743c4cbc1e293cdbd8c3b01 - Cache
======== Computing necessary packages ========
libb/1.0: Forced build from source
Requirements
liba/1.0#0fbf481ef3fd42eb7fe3a14079aa6d3a:a818caff19c116dafdc2337a9b30675bd75e8985#0869d12165cd20d41b0d942057c169af - Cache
libb/1.0#63571d919743c4cbc1e293cdbd8c3b01:5527a2ac492ae26512f43737725dfdbdee4016aa - Build
======== Installing packages ========
liba/1.0: Already installed! (1 of 2)
-------- Installing package libb/1.0 (2 of 2) --------
libb/1.0: Building from source
libb/1.0: Package libb/1.0:5527a2ac492ae26512f43737725dfdbdee4016aa
libb/1.0: settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=14 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
libb/1.0: options: shared=True
libb/1.0: requires: liba/1.0.Z
libb/1.0: Copying sources to build folder
libb/1.0: Building your package in C:\Users\Todiq\AppData\Local\Temp\conan\p\b\libb64bb31909ff37\b
libb/1.0: Calling generate()
libb/1.0: Generators folder: C:\Users\Todiq\AppData\Local\Temp\conan\p\b\libb64bb31909ff37\b\build\generators
libb/1.0: CMakeDeps necessary find_package() and targets for your CMakeLists.txt
find_package(liba)
target_link_libraries(... liba::liba)
libb/1.0: CMakeToolchain generated: conan_toolchain.cmake
libb/1.0: CMakeToolchain generated: C:\Users\Todiq\AppData\Local\Temp\conan\p\b\libb64bb31909ff37\b\build\generators\CMakePresets.json
libb/1.0: CMakeToolchain generated: C:\Users\Todiq\AppData\Local\Temp\conan\p\b\libb64bb31909ff37\b\CMakeUserPresets.json
libb/1.0: Generating aggregated env files
libb/1.0: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
libb/1.0: Calling build()
libb/1.0: Running CMake.configure()
libb/1.0: RUN: cmake -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="C:/Users/Todiq/AppData/Local/Temp/conan/p/b/libb64bb31909ff37/p" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" "C:/Users/Todiq/AppData/Local/Temp/conan/p/b/libb64bb31909ff37/b"
-- Using Conan toolchain: C:/Users/Todiq/AppData/Local/Temp/conan/p/b/libb64bb31909ff37/b/build/generators/conan_toolchain.cmake
-- Conan toolchain: CMAKE_GENERATOR_TOOLSET=v143
-- Conan toolchain: Setting CMAKE_MSVC_RUNTIME_LIBRARY=$<$<CONFIG:Release>:MultiThreadedDLL>
-- Conan toolchain: C++ Standard 14 with extensions OFF
-- Conan toolchain: Setting BUILD_SHARED_LIBS = ON
-- The CXX compiler identification is MSVC 19.44.35207.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: Target declared 'liba::liba'
-- Configuring done (2.2s)
-- Generating done (0.0s)
-- Build files have been written to: C:/Users/Todiq/AppData/Local/Temp/conan/p/b/libb64bb31909ff37/b/build
libb/1.0: Running CMake.build()
libb/1.0: RUN: cmake --build "C:\Users\Todiq\AppData\Local\Temp\conan\p\b\libb64bb31909ff37\b\build" --config Release
Version MSBuild 17.14.8+a7a4d5af0 pour .NET Framework
C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(548,5): warning MSB8
029: Le répertoire intermédiaire ou le répertoire de sortie ne peut pas se trouver sous le répertoire temporaire car cela risque de
créer des problèmes avec la génération incrémentielle. [C:\Users\Todiq\AppData\Local\Temp\conan\p\b\libb64bb31909ff37\b\build\ZER
O_CHECK.vcxproj]
1>Checking Build System
C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(548,5): warning MSB8
029: Le répertoire intermédiaire ou le répertoire de sortie ne peut pas se trouver sous le répertoire temporaire car cela risque de
créer des problèmes avec la génération incrémentielle. [C:\Users\Todiq\AppData\Local\Temp\conan\p\b\libb64bb31909ff37\b\build\lib
b.vcxproj]
Building Custom Rule C:/Users/Todiq/AppData/Local/Temp/conan/p/b/libb64bb31909ff37/b/CMakeLists.txt
libb.cpp
Création de la bibliothèque C:/Users/Todiq/AppData/Local/Temp/conan/p/b/libb64bb31909ff37/b/build/Release/libb.lib et de l'o
bjet C:/Users/Todiq/AppData/Local/Temp/conan/p/b/libb64bb31909ff37/b/build/Release/libb.exp
libb.vcxproj -> C:\Users\Todiq\AppData\Local\Temp\conan\p\b\libb64bb31909ff37\b\build\Release\libb.dll
C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(548,5): warning MSB8
029: Le répertoire intermédiaire ou le répertoire de sortie ne peut pas se trouver sous le répertoire temporaire car cela risque de
créer des problèmes avec la génération incrémentielle. [C:\Users\Todiq\AppData\Local\Temp\conan\p\b\libb64bb31909ff37\b\build\ALL
_BUILD.vcxproj]
Building Custom Rule C:/Users/Todiq/AppData/Local/Temp/conan/p/b/libb64bb31909ff37/b/CMakeLists.txt
libb/1.0: Package '5527a2ac492ae26512f43737725dfdbdee4016aa' built
libb/1.0: Build folder C:\Users\Todiq\AppData\Local\Temp\conan\p\b\libb64bb31909ff37\b\build
libb/1.0: Generating the package
libb/1.0: Packaging in folder C:\Users\Todiq\AppData\Local\Temp\conan\p\b\libb64bb31909ff37\p
libb/1.0: Calling package()
libb/1.0: Running CMake.install()
libb/1.0: RUN: cmake --install "C:\Users\Todiq\AppData\Local\Temp\conan\p\b\libb64bb31909ff37\b\build" --config Release --prefix "C:/Users/Todiq/AppData/Local/Temp/conan/p/b/libb64bb31909ff37/p"
-- Installing: C:/Users/Todiq/AppData/Local/Temp/conan/p/b/libb64bb31909ff37/p/lib/libb.lib
-- Installing: C:/Users/Todiq/AppData/Local/Temp/conan/p/b/libb64bb31909ff37/p/bin/libb.dll
-- Installing: C:/Users/Todiq/AppData/Local/Temp/conan/p/b/libb64bb31909ff37/p/include/libb.h
libb/1.0: package(): Packaged 1 '.dll' file: libb.dll
libb/1.0: package(): Packaged 1 '.h' file: libb.h
libb/1.0: package(): Packaged 1 '.lib' file: libb.lib
libb/1.0: Created package revision b6b8d2fd28e7cdbd74a06dd29e838f54
libb/1.0: Package '5527a2ac492ae26512f43737725dfdbdee4016aa' created
libb/1.0: Full package reference: libb/1.0#63571d919743c4cbc1e293cdbd8c3b01:5527a2ac492ae26512f43737725dfdbdee4016aa#b6b8d2fd28e7cdbd74a06dd29e838f54
libb/1.0: Package folder C:\Users\Todiq\AppData\Local\Temp\conan\p\b\libb64bb31909ff37\p
(venv) C:\Users\Todiq\AppData\Local\Temp>conan new cmake_exe -d "name=app" -d "requires=libb/1.0" -o "app"
File saved: CMakeLists.txt
File saved: conanfile.py
File saved: src/app.cpp
File saved: src/app.h
File saved: src/main.cpp
File saved: test_package/conanfile.py
(venv) C:\Users\Todiq\AppData\Local\Temp>type app\conanfile.py
import os, platform
from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout
class Recipe(ConanFile):
name = "app"
version = "1.0"
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps", "CMakeToolchain"
package_type = "application"
exports_sources = "CMakeLists.txt", "src/*"
requires = "libb/1.0"
def layout(self):
cmake_layout(self)
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
cmake = CMake(self)
cmake.install()
def package_info(self):
self.cpp_info.exe = "app"
name = "app.exe" if platform.system() == "Windows" else "app"
self.cpp_info.location = os.path.join("bin", name)
(venv) C:\Users\Todiq\AppData\Local\Temp>conan create app -o "*:shared=True"
======== Exporting recipe to the cache ========
app/1.0: Exporting package recipe: C:\Users\Todiq\AppData\Local\Temp\app\conanfile.py
app/1.0: Copied 1 '.py' file: conanfile.py
app/1.0: Copied 1 '.txt' file: CMakeLists.txt
app/1.0: Copied 2 '.cpp' files: app.cpp, main.cpp
app/1.0: Copied 1 '.h' file: app.h
app/1.0: Exported to cache folder: C:\Users\Todiq\AppData\Local\Temp\conan\p\app28957e002c4aa\e
app/1.0: Exported: app/1.0#622b7c64f9ea1e40b331659fbbd18b23 (2025-06-17 12:26:38 UTC)
======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
[options]
*:shared=True
Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
======== Computing dependency graph ========
Graph root
cli
Requirements
app/1.0#622b7c64f9ea1e40b331659fbbd18b23 - Cache
liba/1.0#0fbf481ef3fd42eb7fe3a14079aa6d3a - Cache
libb/1.0#63571d919743c4cbc1e293cdbd8c3b01 - Cache
======== Computing necessary packages ========
app/1.0: Forced build from source
Requirements
app/1.0#622b7c64f9ea1e40b331659fbbd18b23:472cbe405284f0574862362b67fe72f21448e5b0 - Build
liba/1.0#0fbf481ef3fd42eb7fe3a14079aa6d3a:a818caff19c116dafdc2337a9b30675bd75e8985#0869d12165cd20d41b0d942057c169af - Cache
libb/1.0#63571d919743c4cbc1e293cdbd8c3b01:5527a2ac492ae26512f43737725dfdbdee4016aa#b6b8d2fd28e7cdbd74a06dd29e838f54 - Cache
======== Installing packages ========
liba/1.0: Already installed! (1 of 3)
libb/1.0: Already installed! (2 of 3)
-------- Installing package app/1.0 (3 of 3) --------
app/1.0: Building from source
app/1.0: Package app/1.0:472cbe405284f0574862362b67fe72f21448e5b0
app/1.0: settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=14 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
app/1.0: requires: libb/1.0.Z
app/1.0: Copying sources to build folder
app/1.0: Building your package in C:\Users\Todiq\AppData\Local\Temp\conan\p\b\app59c7370384dd6\b
app/1.0: Writing generators to C:\Users\Todiq\AppData\Local\Temp\conan\p\b\app59c7370384dd6\b\build\generators
app/1.0: Generator 'CMakeDeps' calling 'generate()'
app/1.0: CMakeDeps necessary find_package() and targets for your CMakeLists.txt
find_package(libb)
target_link_libraries(... libb::libb)
app/1.0: Generator 'CMakeToolchain' calling 'generate()'
app/1.0: CMakeToolchain generated: conan_toolchain.cmake
app/1.0: CMakeToolchain generated: C:\Users\Todiq\AppData\Local\Temp\conan\p\b\app59c7370384dd6\b\build\generators\CMakePresets.json
app/1.0: CMakeToolchain generated: C:\Users\Todiq\AppData\Local\Temp\conan\p\b\app59c7370384dd6\b\CMakeUserPresets.json
app/1.0: Generating aggregated env files
app/1.0: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
app/1.0: Calling build()
app/1.0: Running CMake.configure()
app/1.0: RUN: cmake -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="C:/Users/Todiq/AppData/Local/Temp/conan/p/b/app59c7370384dd6/p" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" "C:/Users/Todiq/AppData/Local/Temp/conan/p/b/app59c7370384dd6/b"
-- Using Conan toolchain: C:/Users/Todiq/AppData/Local/Temp/conan/p/b/app59c7370384dd6/b/build/generators/conan_toolchain.cmake
-- Conan toolchain: CMAKE_GENERATOR_TOOLSET=v143
-- Conan toolchain: Setting CMAKE_MSVC_RUNTIME_LIBRARY=$<$<CONFIG:Release>:MultiThreadedDLL>
-- Conan toolchain: C++ Standard 14 with extensions OFF
-- The CXX compiler identification is MSVC 19.44.35207.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: Target declared 'libb::libb'
-- Conan: Target declared 'liba::liba'
-- Configuring done (2.2s)
-- Generating done (0.0s)
-- Build files have been written to: C:/Users/Todiq/AppData/Local/Temp/conan/p/b/app59c7370384dd6/b/build
app/1.0: Running CMake.build()
app/1.0: RUN: cmake --build "C:\Users\Todiq\AppData\Local\Temp\conan\p\b\app59c7370384dd6\b\build" --config Release
Version MSBuild 17.14.8+a7a4d5af0 pour .NET Framework
C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(548,5): warning MSB8
029: Le répertoire intermédiaire ou le répertoire de sortie ne peut pas se trouver sous le répertoire temporaire car cela risque de
créer des problèmes avec la génération incrémentielle. [C:\Users\Todiq\AppData\Local\Temp\conan\p\b\app59c7370384dd6\b\build\ZERO
_CHECK.vcxproj]
1>Checking Build System
C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(548,5): warning MSB8
029: Le répertoire intermédiaire ou le répertoire de sortie ne peut pas se trouver sous le répertoire temporaire car cela risque de
créer des problèmes avec la génération incrémentielle. [C:\Users\Todiq\AppData\Local\Temp\conan\p\b\app59c7370384dd6\b\build\app.
vcxproj]
Building Custom Rule C:/Users/Todiq/AppData/Local/Temp/conan/p/b/app59c7370384dd6/b/CMakeLists.txt
app.cpp
main.cpp
Création de la bibliothèque C:/Users/Todiq/AppData/Local/Temp/conan/p/b/app59c7370384dd6/b/build/Release/app.lib et de l'obj
et C:/Users/Todiq/AppData/Local/Temp/conan/p/b/app59c7370384dd6/b/build/Release/app.exp
app.vcxproj -> C:\Users\Todiq\AppData\Local\Temp\conan\p\b\app59c7370384dd6\b\build\Release\app.exe
C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(548,5): warning MSB8
029: Le répertoire intermédiaire ou le répertoire de sortie ne peut pas se trouver sous le répertoire temporaire car cela risque de
créer des problèmes avec la génération incrémentielle. [C:\Users\Todiq\AppData\Local\Temp\conan\p\b\app59c7370384dd6\b\build\ALL_
BUILD.vcxproj]
Building Custom Rule C:/Users/Todiq/AppData/Local/Temp/conan/p/b/app59c7370384dd6/b/CMakeLists.txt
app/1.0: Package '472cbe405284f0574862362b67fe72f21448e5b0' built
app/1.0: Build folder C:\Users\Todiq\AppData\Local\Temp\conan\p\b\app59c7370384dd6\b\build
app/1.0: Generating the package
app/1.0: Packaging in folder C:\Users\Todiq\AppData\Local\Temp\conan\p\b\app59c7370384dd6\p
app/1.0: Calling package()
app/1.0: Running CMake.install()
app/1.0: RUN: cmake --install "C:\Users\Todiq\AppData\Local\Temp\conan\p\b\app59c7370384dd6\b\build" --config Release --prefix "C:/Users/Todiq/AppData/Local/Temp/conan/p/b/app59c7370384dd6/p"
-- Installing: C:/Users/Todiq/AppData/Local/Temp/conan/p/b/app59c7370384dd6/p/bin/app.exe
app/1.0: package(): Packaged 1 '.exe' file: app.exe
app/1.0: Created package revision caa18c11b38eac6b09f299c2ec29dfc4
app/1.0: Package '472cbe405284f0574862362b67fe72f21448e5b0' created
app/1.0: Full package reference: app/1.0#622b7c64f9ea1e40b331659fbbd18b23:472cbe405284f0574862362b67fe72f21448e5b0#caa18c11b38eac6b09f299c2ec29dfc4
app/1.0: Package folder C:\Users\Todiq\AppData\Local\Temp\conan\p\b\app59c7370384dd6\p
======== Launching test_package ========
======== Computing dependency graph ========
Graph root
app/1.0 (test package): C:\Users\Todiq\AppData\Local\Temp\app\test_package\conanfile.py
Requirements
app/1.0#622b7c64f9ea1e40b331659fbbd18b23 - Cache
liba/1.0#0fbf481ef3fd42eb7fe3a14079aa6d3a - Cache
libb/1.0#63571d919743c4cbc1e293cdbd8c3b01 - Cache
======== Computing necessary packages ========
Requirements
app/1.0#622b7c64f9ea1e40b331659fbbd18b23:472cbe405284f0574862362b67fe72f21448e5b0#caa18c11b38eac6b09f299c2ec29dfc4 - Cache
liba/1.0#0fbf481ef3fd42eb7fe3a14079aa6d3a:a818caff19c116dafdc2337a9b30675bd75e8985#0869d12165cd20d41b0d942057c169af - Cache
libb/1.0#63571d919743c4cbc1e293cdbd8c3b01:5527a2ac492ae26512f43737725dfdbdee4016aa#b6b8d2fd28e7cdbd74a06dd29e838f54 - Cache
======== Installing packages ========
liba/1.0: Already installed! (1 of 3)
libb/1.0: Already installed! (2 of 3)
app/1.0: Already installed! (3 of 3)
======== Testing the package ========
app/1.0 (test package): Test package build:
app/1.0 (test package): Test package build folder: C:\Users\Todiq\AppData\Local\Temp\app\test_package
app/1.0 (test package): Generating aggregated env files
app/1.0 (test package): Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
======== Testing the package: Building ========
======== Testing the package: Executing test ========
app/1.0 (test package): Running test()
app/1.0 (test package): RUN: app
liba/1.0: Hello World Release!
liba/1.0: _M_X64 defined
liba/1.0: MSVC runtime: MultiThreadedDLL
liba/1.0: _MSC_VER1944
liba/1.0: _MSVC_LANG201402
liba/1.0: __cplusplus199711
libb/1.0: Hello World Release!
libb/1.0: _M_X64 defined
libb/1.0: MSVC runtime: MultiThreadedDLL
libb/1.0: _MSC_VER1944
libb/1.0: _MSVC_LANG201402
libb/1.0: __cplusplus199711
app/0.1: Hello World Release!
app/0.1: _M_X64 defined
app/0.1: MSVC runtime: MultiThreadedDLL
app/0.1: _MSC_VER1944
app/0.1: _MSVC_LANG201402
app/0.1: __cplusplus199711
app/0.1 test_package
(venv) C:\Users\Todiq\AppData\Local\Temp>type CMakeLists.txt
cmake_minimum_required(VERSION 3.15)
project(myproject CXX)
find_package(app)
message(STATUS "CONAN_RUNTIME_LIB_DIRS=${CONAN_RUNTIME_LIB_DIRS}")
install(
IMPORTED_RUNTIME_ARTIFACTS
app::app
RUNTIME_DEPENDENCY_SET
my_app_deps
)
install(RUNTIME_DEPENDENCY_SET my_app_deps
PRE_EXCLUDE_REGEXES
[=[api-ms-]=]
[=[ext-ms-]=]
[[kernel32\.dll]]
[[libc\.so\..*]] [[libgcc_s\.so\..*]] [[libm\.so\..*]] [[libstdc\+\+\.so\..*]]
POST_EXCLUDE_REGEXES
[=[.*system32\/.*\.dll]=]
[=[^\/(lib|usr\/lib|usr\/local\/lib\/lib64)]=]
DIRECTORIES
${CONAN_RUNTIME_LIB_DIRS}
)
(venv) C:\Users\Todiq\AppData\Local\Temp>type conanfile.py
from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout
class Recipe(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps", "CMakeToolchain"
requires = "app/1.0"
def layout(self):
cmake_layout(self)
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
cmake.install()
(venv) C:\Users\Todiq\AppData\Local\Temp>conan build . -o "*:shared=True" -c "tools.cmake.cmakedeps:new=will_break_next"
======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
[options]
*:shared=True
[conf]
tools.cmake.cmakedeps:new=will_break_next
Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
======== Computing dependency graph ========
Graph root
conanfile.py: C:\Users\Todiq\AppData\Local\Temp\conanfile.py
Requirements
app/1.0#622b7c64f9ea1e40b331659fbbd18b23 - Cache
liba/1.0#0fbf481ef3fd42eb7fe3a14079aa6d3a - Cache
libb/1.0#63571d919743c4cbc1e293cdbd8c3b01 - Cache
======== Computing necessary packages ========
Requirements
app/1.0#622b7c64f9ea1e40b331659fbbd18b23:472cbe405284f0574862362b67fe72f21448e5b0#caa18c11b38eac6b09f299c2ec29dfc4 - Cache
liba/1.0#0fbf481ef3fd42eb7fe3a14079aa6d3a:a818caff19c116dafdc2337a9b30675bd75e8985#0869d12165cd20d41b0d942057c169af - Cache
libb/1.0#63571d919743c4cbc1e293cdbd8c3b01:5527a2ac492ae26512f43737725dfdbdee4016aa#b6b8d2fd28e7cdbd74a06dd29e838f54 - Cache
======== Installing packages ========
liba/1.0: Already installed! (1 of 3)
libb/1.0: Already installed! (2 of 3)
app/1.0: Already installed! (3 of 3)
======== Finalizing install (deploy, generators) ========
conanfile.py: Writing generators to C:\Users\Todiq\AppData\Local\Temp
conanfile.py: WARN: Using the new CMakeConfigDeps generator, behind the 'tools.cmake.cmakedeps:new' gate conf. This conf will change next release, breaking, so use it only for testing and dev
conanfile.py: Generator 'CMakeDeps' calling 'generate()'
conanfile.py: CMakeDeps necessary find_package() and targets for your CMakeLists.txt
find_package(app)
conanfile.py: Generator 'CMakeToolchain' calling 'generate()'
conanfile.py: CMakeToolchain generated: conan_toolchain.cmake
conanfile.py: CMakeToolchain: Preset 'conan-default' added to CMakePresets.json.
(cmake>=3.23) cmake --preset conan-default
(cmake<3.23) cmake <path> -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW
conanfile.py: CMakeToolchain generated: C:\Users\Todiq\AppData\Local\Temp\CMakePresets.json
conanfile.py: Generating aggregated env files
conanfile.py: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
======== Calling build() ========
(venv) C:\Users\Todiq\AppData\Local\Temp>
The consumer conanfile.py seem broken? (wrong indents)
from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout
class Recipe(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps", "CMakeToolchain"
requires = "app/1.0"
def layout(self):
cmake_layout(self)
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
cmake.install()
Note the def build(self) will not be a method of the recipe, but a free function. As such, the class Recipe recipe doesn't have a build() method to run at all.
Should've seen that simple mistake. Thank you for fixing it.
Indeed, it seems to work this way, and all the transitive libs install properly! Super nice!!
However, if I set app as editable, the executable cannot seem to be found:
Logs
Click to expand log
(venv) C:\Users\Todiq\AppData\Local\Temp>conan editable add app
Reference 'app/1.0' in editable mode
(venv) C:\Users\Todiq\AppData\Local\Temp>conan build app -o "*:shared=True"
======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
[options]
*:shared=True
Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
======== Computing dependency graph ========
Graph root
conanfile.py (app/1.0): C:\Users\Todiq\AppData\Local\Temp\app\conanfile.py
Requirements
liba/1.0#0fbf481ef3fd42eb7fe3a14079aa6d3a - Cache
libb/1.0#63571d919743c4cbc1e293cdbd8c3b01 - Cache
======== Computing necessary packages ========
Requirements
liba/1.0#0fbf481ef3fd42eb7fe3a14079aa6d3a:a818caff19c116dafdc2337a9b30675bd75e8985#94f4c3445e9d525418a9d88a388c6c31 - Cache
libb/1.0#63571d919743c4cbc1e293cdbd8c3b01:5527a2ac492ae26512f43737725dfdbdee4016aa#fe0fb4458131fab337a38446e5cb8e6b - Cache
======== Installing packages ========
liba/1.0: Already installed! (1 of 2)
libb/1.0: Already installed! (2 of 2)
======== Finalizing install (deploy, generators) ========
conanfile.py (app/1.0): Writing generators to C:\Users\Todiq\AppData\Local\Temp\app\build\generators
conanfile.py (app/1.0): Generator 'CMakeDeps' calling 'generate()'
conanfile.py (app/1.0): CMakeDeps necessary find_package() and targets for your CMakeLists.txt
find_package(libb)
target_link_libraries(... libb::libb)
conanfile.py (app/1.0): Generator 'CMakeToolchain' calling 'generate()'
conanfile.py (app/1.0): CMakeToolchain generated: conan_toolchain.cmake
conanfile.py (app/1.0): CMakeToolchain: Preset 'conan-default' added to CMakePresets.json.
(cmake>=3.23) cmake --preset conan-default
(cmake<3.23) cmake <path> -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE=generators\conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW
conanfile.py (app/1.0): CMakeToolchain generated: C:\Users\Todiq\AppData\Local\Temp\app\build\generators\CMakePresets.json
conanfile.py (app/1.0): CMakeToolchain generated: C:\Users\Todiq\AppData\Local\Temp\app\CMakeUserPresets.json
conanfile.py (app/1.0): Generating aggregated env files
conanfile.py (app/1.0): Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
======== Calling build() ========
conanfile.py (app/1.0): Calling build()
conanfile.py (app/1.0): Running CMake.configure()
conanfile.py (app/1.0): RUN: cmake -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="C:/Users/Todiq/AppData/Local/Temp/app" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" "C:/Users/Todiq/AppData/Local/Temp/app"
-- Using Conan toolchain: C:/Users/Todiq/AppData/Local/Temp/app/build/generators/conan_toolchain.cmake
-- Conan toolchain: CMAKE_GENERATOR_TOOLSET=v143
-- Conan toolchain: Setting CMAKE_MSVC_RUNTIME_LIBRARY=$<$<CONFIG:Release>:MultiThreadedDLL>
-- Conan toolchain: C++ Standard 14 with extensions OFF
-- The CXX compiler identification is MSVC 19.44.35207.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: Target declared 'libb::libb'
-- Conan: Target declared 'liba::liba'
-- Configuring done (5.4s)
-- Generating done (0.0s)
-- Build files have been written to: C:/Users/Todiq/AppData/Local/Temp/app/build
conanfile.py (app/1.0): Running CMake.build()
conanfile.py (app/1.0): RUN: cmake --build "C:\Users\Todiq\AppData\Local\Temp\app\build" --config Release
Version MSBuild 17.14.8+a7a4d5af0 pour .NET Framework
C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(548,5): warning MSB8
029: Le répertoire intermédiaire ou le répertoire de sortie ne peut pas se trouver sous le répertoire temporaire car cela risque de
créer des problèmes avec la génération incrémentielle. [C:\Users\Todiq\AppData\Local\Temp\app\build\ZERO_CHECK.vcxproj]
1>Checking Build System
C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(548,5): warning MSB8
029: Le répertoire intermédiaire ou le répertoire de sortie ne peut pas se trouver sous le répertoire temporaire car cela risque de
créer des problèmes avec la génération incrémentielle. [C:\Users\Todiq\AppData\Local\Temp\app\build\app.vcxproj]
Building Custom Rule C:/Users/Todiq/AppData/Local/Temp/app/CMakeLists.txt
app.cpp
main.cpp
Création de la bibliothèque C:/Users/Todiq/AppData/Local/Temp/app/build/Release/app.lib et de l'objet C:/Users/Todiq/AppD
ata/Local/Temp/app/build/Release/app.exp
app.vcxproj -> C:\Users\Todiq\AppData\Local\Temp\app\build\Release\app.exe
C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(548,5): warning MSB8
029: Le répertoire intermédiaire ou le répertoire de sortie ne peut pas se trouver sous le répertoire temporaire car cela risque de
créer des problèmes avec la génération incrémentielle. [C:\Users\Todiq\AppData\Local\Temp\app\build\ALL_BUILD.vcxproj]
Building Custom Rule C:/Users/Todiq/AppData/Local/Temp/app/CMakeLists.txt
(venv) C:\Users\Todiq\AppData\Local\Temp>conan build . -o "*:shared=True" -c "tools.cmake.cmakedeps:new=will_break_next"
======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
[options]
*:shared=True
[conf]
tools.cmake.cmakedeps:new=will_break_next
Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
======== Computing dependency graph ========
Graph root
conanfile.py: C:\Users\Todiq\AppData\Local\Temp\conanfile.py
Requirements
app/1.0 - Editable
liba/1.0#0fbf481ef3fd42eb7fe3a14079aa6d3a - Cache
libb/1.0#63571d919743c4cbc1e293cdbd8c3b01 - Cache
======== Computing necessary packages ========
Requirements
app/1.0:472cbe405284f0574862362b67fe72f21448e5b0 - Editable
liba/1.0#0fbf481ef3fd42eb7fe3a14079aa6d3a:a818caff19c116dafdc2337a9b30675bd75e8985#94f4c3445e9d525418a9d88a388c6c31 - Cache
libb/1.0#63571d919743c4cbc1e293cdbd8c3b01:5527a2ac492ae26512f43737725dfdbdee4016aa#fe0fb4458131fab337a38446e5cb8e6b - Cache
======== Installing packages ========
liba/1.0: Already installed! (1 of 3)
libb/1.0: Already installed! (2 of 3)
app/1.0: Rewriting files of editable package 'app' at 'C:\Users\Todiq\AppData\Local\Temp\app\build\generators'
app/1.0: Writing generators to C:\Users\Todiq\AppData\Local\Temp\app\build\generators
app/1.0: WARN: Using the new CMakeConfigDeps generator, behind the 'tools.cmake.cmakedeps:new' gate conf. This conf will change next release, breaking, so use it only for testing and dev
app/1.0: Generator 'CMakeDeps' calling 'generate()'
app/1.0: CMakeDeps necessary find_package() and targets for your CMakeLists.txt
find_package(libb)
target_link_libraries(... libb::libb)
app/1.0: Generator 'CMakeToolchain' calling 'generate()'
app/1.0: CMakeToolchain generated: conan_toolchain.cmake
app/1.0: CMakeToolchain generated: C:\Users\Todiq\AppData\Local\Temp\app\build\generators\CMakePresets.json
app/1.0: CMakeToolchain generated: C:\Users\Todiq\AppData\Local\Temp\app\CMakeUserPresets.json
app/1.0: Generating aggregated env files
app/1.0: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
======== Finalizing install (deploy, generators) ========
conanfile.py: Writing generators to C:\Users\Todiq\AppData\Local\Temp\build\generators
conanfile.py: WARN: Using the new CMakeConfigDeps generator, behind the 'tools.cmake.cmakedeps:new' gate conf. This conf will change next release, breaking, so use it only for testing and dev
conanfile.py: Generator 'CMakeDeps' calling 'generate()'
conanfile.py: CMakeDeps necessary find_package() and targets for your CMakeLists.txt
find_package(app)
conanfile.py: Generator 'CMakeToolchain' calling 'generate()'
conanfile.py: CMakeToolchain generated: conan_toolchain.cmake
conanfile.py: CMakeToolchain: Preset 'conan-default' added to CMakePresets.json.
(cmake>=3.23) cmake --preset conan-default
(cmake<3.23) cmake <path> -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE=generators\conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW
conanfile.py: CMakeToolchain generated: C:\Users\Todiq\AppData\Local\Temp\build\generators\CMakePresets.json
conanfile.py: CMakeToolchain generated: C:\Users\Todiq\AppData\Local\Temp\CMakeUserPresets.json
conanfile.py: Generating aggregated env files
conanfile.py: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
======== Calling build() ========
conanfile.py: Calling build()
conanfile.py: Running CMake.configure()
conanfile.py: RUN: cmake -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="C:/Users/Todiq/AppData/Local/Temp" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" "C:/Users/Todiq/AppData/Local/Temp"
-- Using Conan toolchain: C:/Users/Todiq/AppData/Local/Temp/build/generators/conan_toolchain.cmake
-- Conan toolchain: CMAKE_GENERATOR_TOOLSET=v143
-- Conan toolchain: Setting CMAKE_MSVC_RUNTIME_LIBRARY=$<$<CONFIG:Release>:MultiThreadedDLL>
-- Conan toolchain: C++ Standard 14 with extensions OFF
-- Conan toolchain: Including CMakeDeps generated conan_cmakedeps_paths.cmake
-- The CXX compiler identification is MSVC 19.44.35207.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: Configuring Targets for app/1.0
-- Conan: Configuring Targets for libb/1.0
-- Conan: Configuring Targets for liba/1.0
-- Conan: Target declared imported SHARED library 'liba::liba'
-- Conan: Target declared imported SHARED library 'libb::libb'
-- Conan: Target declared imported executable 'app::app' host
-- CONAN_RUNTIME_LIB_DIRS=$<$<CONFIG:Release>:C:/Users/Todiq/AppData/Local/Temp/build/generators/../../app/build/Release>;$<$<CONFIG:Release>:C:/Users/Todiq/AppData/Local/Temp/build/generators/../../conan/p/b/libb2c8ce5759a93c/p/bin>;$<$<CONFIG:Release>:C:/Users/Todiq/AppData/Local/Temp/build/generators/../../conan/p/b/liba8a5b8f46731a9/p/bin>
-- Configuring done (3.8s)
-- Generating done (0.0s)
-- Build files have been written to: C:/Users/Todiq/AppData/Local/Temp/build
conanfile.py: Running CMake.build()
conanfile.py: RUN: cmake --build "C:\Users\Todiq\AppData\Local\Temp\build" --config Release
Version MSBuild 17.14.8+a7a4d5af0 pour .NET Framework
C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(548,5): warning MSB8
029: Le répertoire intermédiaire ou le répertoire de sortie ne peut pas se trouver sous le répertoire temporaire car cela risque de
créer des problèmes avec la génération incrémentielle. [C:\Users\Todiq\AppData\Local\Temp\build\ZERO_CHECK.vcxproj]
1>Checking Build System
C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(548,5): warning MSB8
029: Le répertoire intermédiaire ou le répertoire de sortie ne peut pas se trouver sous le répertoire temporaire car cela risque de
créer des problèmes avec la génération incrémentielle. [C:\Users\Todiq\AppData\Local\Temp\build\ALL_BUILD.vcxproj]
Building Custom Rule C:/Users/Todiq/AppData/Local/Temp/CMakeLists.txt
conanfile.py: Running CMake.install()
conanfile.py: RUN: cmake --install "C:\Users\Todiq\AppData\Local\Temp\build" --config Release --prefix "C:/Users/Todiq/AppData/Local/Temp"
CMake Error at cmake_install.cmake:39 (file):
file INSTALL cannot find
"C:/Users/Todiq/AppData/Local/Temp/build/generators/../../app/bin/app.exe":
File exists.
ERROR: conanfile.py: Error in build() method, line 17
cmake.install()
ConanException: Error 1 while executing
(venv) C:\Users\Todiq\AppData\Local\Temp>
I tried editing the layout() method:
def layout(self):
bt = "." if self.settings.get_safe("os") != "Windows" else str(self.settings.build_type)
ext = "" if self.settings.get_safe("os") != "Windows" else ".exe"
cmake_layout(self)
self.cpp.build.exe = "app"
self.cpp.build.location = os.path.join(bt, f"app{ext}")
self.cpp.package.exe = "app"
self.cpp.package.location = os.path.join("bin", f"app{ext}")
But I get the same error:
CMake Error at cmake_install.cmake:39 (file):
file INSTALL cannot find
"C:/Users/Todiq/AppData/Local/Temp/build/generators/../../app/bin/app.exe":
No error.
ERROR: conanfile.py: Error in build() method, line 17
cmake.install()
ConanException: Error 1 while executing
Indeed, it seems to work this way, and all the transitive libs install properly! Super nice!!
Great, happy to hear that!
However, if I set app as editable, the executable cannot seem to be found:
Thanks for the details.
Yes, the editable information is not expected to work yet for .exe targets, it has not been implemented yet.
I'll have a look at this.
Perfect, thank you!
I'll have a look at this.
Re-opening, I am investigating this to try to support editable case for new exe imported targets :)
My bad. Since the original issue was resolved, I thought you would want to create a new, separated feature request
No prob :)
Yes, depending on how it goes, I might open a new ticket, or just use this one. Don't worry about that, I will manage.
Closed by https://github.com/conan-io/conan/pull/18489, the self.cpp.build.exe + location will work on Conan 2.18 for editable packages. Thanks again for the feedback!
Hello @memsharded,
Thanks a lot!
I tried the new feature, and I have a quick question:
Would it be possible for the self.cpp.build.location attribute to automatically look inside the full build folder path, like for self.cpp.build.libdirs? Or may I have missed something there?
Same goes for when in package mode: by default, should the .location default to look inside the self.cpp_info.bindirs, unless specified otherwise?
Would it be possible for the self.cpp.build.location attribute to automatically look inside the full build folder path, like for self.cpp.build.libdirs? Or may I have missed something there?
Same goes for when in package mode: by default, should the .location default to look inside the self.cpp_info.bindirs, unless specified otherwise?
The idea of the new .location field, both in libraries and executables is to be aligned with the CPS specification, that is, it provides the relative path to the artifact (including full name). At the moment there are no plans to make anything automatic or implicit, but the idea is that the definition should be as explicit as a CPS file would be. Of course the idea is that recipes will not have to implement that manually, because it will be just a matter of reading the .cps file provided by the build system as an output of the build.