You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a CMake project and in the CMakeLists.txt file I generate two targets: add_library(myproj::mylib ...) and add_executable(myproj::myexec ...). The Conan documentation explains well what to write in the package_info() method in the conanfile.py file to have Conan generate a CMake target for myproj::mylib but how can I have Conan generate the CMake target myproj::myexec? I want to create a Conan package for myproj and consume it in another project. In the other project, I want to reference the executable via its target name myproj::myexec. For example:
Conan has not an explicit model to add that executable target. Probably, the best option is to create a custom build module with your target definition and then add it to the cpp_info in the package_info() method using the cmake_build_modules property, like:
Conan 2.9 introduced a new CMakeDeps generator that generate targets for executables: #16964
It is in dev-state at the moment, enabled with -c tools.cmake.cmakedeps:new=will_break_next (the value changes in every release to guarantee dev-status and not usable in production until we get enough feedback).
I am closing this ticket as solved, feedback very welcome, please create new tickets for any feedback or issue related to this new CMakeDeps generator, many thanks!
I have a CMake project and in the CMakeLists.txt file I generate two targets: add_library(myproj::mylib ...) and add_executable(myproj::myexec ...). The Conan documentation explains well what to write in the package_info() method in the conanfile.py file to have Conan generate a CMake target for myproj::mylib but how can I have Conan generate the CMake target myproj::myexec? I want to create a Conan package for myproj and consume it in another project. In the other project, I want to reference the executable via its target name myproj::myexec. For example:
The text was updated successfully, but these errors were encountered: