Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support installing *_importfiles for header-only target #1747

Closed
xq114 opened this issue Oct 16, 2021 · 4 comments
Closed

support installing *_importfiles for header-only target #1747

xq114 opened this issue Oct 16, 2021 · 4 comments

Comments

@xq114
Copy link
Contributor

xq114 commented Oct 16, 2021

你在什么场景下需要该功能?

需要为header-only的target导出pkgconfig和cmake的import files

目前会报错error: install failed, pkgconfig_importfiles: only support for library target(testheader)!

描述可能的解决方案

在header-only target的import files中忽略library,只提供include。eigen库可以作为参考(这是一个header-only library)

@waruqi
Copy link
Member

waruqi commented Oct 16, 2021

我加了个 headeronly 的 target kind ,专门处理这些,install 那个也从 phony 改成 headeronly 好了。

add_rules("mode.release", "mode.debug")

target("foo")
    set_kind("headeronly")
    add_headerfiles("src/foo.h")
    add_rules("utils.install.cmake_importfiles")
    add_rules("utils.install.pkgconfig_importfiles")

cmake import files 我部署,我加了个空的,可以帮忙提个 pr 改下增加对 headerfiles 的支持,https://github.com/xmake-io/xmake/blob/dev/xmake/scripts/cmake_importfiles/xxxTargets-headeronly.cmake

headeronly 下,会装这个而不是 xxxTargets-debug/release.cmake

@waruqi waruqi added this to the v2.5.9 milestone Oct 16, 2021
@waruqi
Copy link
Member

waruqi commented Oct 19, 2021

你先试试,按理 xxxTargets-headeronly.cmake 空的应该也没事,不行到时候再改进下。

@waruqi waruqi closed this as completed Oct 19, 2021
@xq114
Copy link
Contributor Author

xq114 commented Oct 19, 2021

你先试试,按理 xxxTargets-headeronly.cmake 空的应该也没事,不行到时候再改进下。

image
image
headeronly的library类型应该设为interface而不是static/shared;确实不需要Targets-headeronly.cmake文件,可以直接不要

@xq114
Copy link
Contributor Author

xq114 commented Oct 19, 2021

pkgconfig的.pc文件没有正确生成

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants