Skip to content

CCI hook to define targets/components from CMake file API

License

Notifications You must be signed in to change notification settings

SSE4/cci.cmake-file-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

CMake File API conan hook

The conan hook that automatically generates components for package_info method via CMake File API.

installation

use conan config install command:

$ conan config install https://github.com/SSE4/cci.cmake-file-api.git -sf hooks -tf hooks
$ conan config set hooks.cmake_file_api

usage

run conan create against your recipe which use CMake build system.

observe logs (example):

[HOOK - cmake_file_api.py] post_build(): found CMake build directory: "C:\Users\SSE4\.conan\data\kuba-zip\0.1.31\_\_\build\6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7"
[HOOK - cmake_file_api.py] post_build(): found CMake project: "zip"
[HOOK - cmake_file_api.py] post_build(): WARN: project name "zip" is different from conanfile name "kuba-zip"
[HOOK - cmake_file_api.py] post_build(): found CMake STATIC_LIBRARY target: "zip" ("zip.lib")
[HOOK - cmake_file_api.py] post_build(): WARN: target name "zip" is different from conanfile name "kuba-zip"
[HOOK - cmake_file_api.py] post_build(): WARN: consider adding the following code to the "package_info" method:
[HOOK - cmake_file_api.py] post_build(): WARN:
self.cpp_info.names["cmake_find_package"] = "zip"
self.cpp_info.names["cmake_find_package_multi"] = "zip"

self.cpp_info.components["zip"].names["cmake_find_package"] = "zip"
self.cpp_info.components["zip"].names["cmake_find_package_multi"] = "zip"
self.cpp_info.components["zip"].libs = ["zip"]

the code suggested by the hook's output could be copied into the package_info method.

TODO

there are several things that are not supported right now, but very nice to have...

  • system_libs (seems to be not exposed by file API?)
  • 3rd-party dependencies like boost (seems to be not exposed by file API?)
  • executable targets

About

CCI hook to define targets/components from CMake file API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages