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

请教一个问题,cmake如何生成XXXTargets.cmake文件 #17

Open
edidada opened this issue Dec 8, 2022 · 3 comments
Open

请教一个问题,cmake如何生成XXXTargets.cmake文件 #17

edidada opened this issue Dec 8, 2022 · 3 comments

Comments

@edidada
Copy link

edidada commented Dec 8, 2022

cmake如何生成XXXTargets.cmake文件

@edidada
Copy link
Author

edidada commented Dec 8, 2022

@edidada
Copy link
Author

edidada commented Dec 8, 2022

这是我的代码https://github.com/edidada/cmake_library_install

@archibate
Copy link
Collaborator

archibate commented Dec 9, 2022

不需要你这么复杂。设你的项目名叫 Baby。

install(TARGETS babylib1 babylib2 EXPORT BabyTargets)
install(EXPORT BabyTargets FILE BabyConfig.cmake NAMESPACE Baby:: DESTINATION lib/cmake/Baby)

然后别人就可以用 Baby::babylib1 链接你的库。

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

No branches or pull requests

2 participants