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

New CMake versions need FILE_SET installation #143

Closed
ClausKlein opened this issue Aug 9, 2022 · 2 comments · Fixed by #144
Closed

New CMake versions need FILE_SET installation #143

ClausKlein opened this issue Aug 9, 2022 · 2 comments · Fixed by #144
Labels
bug Something isn't working

Comments

@ClausKlein
Copy link
Contributor

ClausKlein commented Aug 9, 2022

New CMake version fails with this error:

CMake error: install TARGETS target my_header_lib is exported but not all of its interface file sets are installed

To prevent this, I need to patch the install rule

Claus-iMac:d3e91bd4d5ecbedc9f73927e56449814005472d0 clausklein$ git diff

diff --git a/src/PackageProject.cmake b/src/PackageProject.cmake
index f272175..8210448 100644
--- a/src/PackageProject.cmake
+++ b/src/PackageProject.cmake
@@ -154,7 +154,9 @@ function(package_project)
     LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
     ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib
     RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
-    PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_PackageProject_NAME}" COMPONENT dev)
+    PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_PackageProject_NAME}" COMPONENT dev
+    FILE_SET HEADERS # NOTE: required from CMake to install the FILE_SET HEADERS too!
+  )
 
   # download ForwardArguments
   FetchContent_Declare(

Claus-iMac:d3e91bd4d5ecbedc9f73927e56449814005472d0 clausklein$

see too https://github.com/ClausKlein/cpp_cmake_project/blob/e393e84856c2842a7a50876417fa14b4b9ea6a27/my_header_lib/CMakeLists.txt#L2

Upvote & Fund

@aminya is using Polar.sh so you can upvote and help fund this issue. The funding is received once the issue is completed & confirmed by you.

Thank you in advance for helping prioritize & fund our backlog!


Fund with Polar
@aminya
Copy link
Owner

aminya commented Aug 9, 2022

Could you make a PR?

@aminya aminya added the bug Something isn't working label Aug 9, 2022
@ClausKlein
Copy link
Contributor Author

Yes, sure

@aminya aminya changed the title CMake error: install TARGETS target my_header_lib is exported but not all of its interface file sets are installed New CMake versions need FILE_SET installation Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants