-
Notifications
You must be signed in to change notification settings - Fork 45
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
Add support for header-only libraries with tribits_add_library() #625
Comments
I need to decide how to test this. I order to ensure that all use cases are supported and to make it easy for people to find this example, it might be good to just add
I think that if I am crafty, I may not need to update the existing tests much if at all. I will see how this goes. |
FYI: This addresses #51 |
…iBITSPub#625) This failing test shows that an INTERFACE library was not getting picked up and linked to the <Package>::all_libs target. The reason the existing tests all passed after adding the initial support for HEAERONLY INTERFACE libraries was that I added the interface library 'mixedlang_vector' before the main 'mixedlang' library. So the new 'mixedlang_vector' library getting written to the MixedLangTargets.cmake file and was getting linked to 'mixedlang' and 'mixedlang' was getting liked to MixedLang::all_libs. So, anyone that was linking against MixedLang::all_libs (from internal or IMPORTED target) was getting the include directories being specified in the 'mixedlang_vector' library. But this implementation fails for TriBITS packages that only has INTERFACE libraries. Those never get added to the <Package>::all_libs target or indirectly to targets that do. This is why the STKEmend package failed because it has just one HEADERONLY INTERFACE library. This test ensures that the INTERFACE library does get linked to the <Package>::all_libs target and will fail if it does not. The next commit will add the code in TriBITS to fix this test :-) Signed-off-by: Roscoe A. Bartlett <[email protected]>
…ub#625) This fixes the previously added failing test :-) Signed-off-by: Roscoe A. Bartlett <[email protected]>
…iBITSPub#625) This failing test shows that an INTERFACE library was not getting picked up and linked to the <Package>::all_libs target. The reason the existing tests all passed after adding the initial support for HEAERONLY INTERFACE libraries was that I added the interface library 'mixedlang_vector' before the main 'mixedlang' library. So the new 'mixedlang_vector' library is getting written to the MixedLangTargets.cmake file and is getting linked to 'mixedlang' and 'mixedlang' was getting liked to MixedLang::all_libs. So, anyone that was linking against MixedLang::all_libs or just the 'mixedlang' LIB (from internal or IMPORTED target) was getting the include directories being specified in the 'mixedlang_vector' library. But this implementation fails for TriBITS packages that only have INTERFACE libraries. Those are never getting added to the <Package>::all_libs target or indirectly to targets that do. This is why the STKEmend package failed because it has just one HEADERONLY INTERFACE library. This new added test case ensures that the INTERFACE library does get linked to the <Package>::all_libs target and will fail if it does not. The next commit will add the code in TriBITS to fix this test :-) Signed-off-by: Roscoe A. Bartlett <[email protected]>
…ub#625) This fixes the previously added failing test :-) Signed-off-by: Roscoe A. Bartlett <[email protected]>
…iBITSPub#625) This failing test shows that an INTERFACE library was not getting picked up and linked to the <Package>::all_libs target. The reason the existing tests all passed after adding the initial support for HEAERONLY INTERFACE libraries was that I added the interface library 'mixedlang_vector' before the main 'mixedlang' library. So the new 'mixedlang_vector' library is getting written to the MixedLangTargets.cmake file and is getting linked to 'mixedlang' and 'mixedlang' was getting liked to MixedLang::all_libs. So, anyone that was linking against MixedLang::all_libs or just the 'mixedlang' LIB (from internal or IMPORTED target) was getting the include directories being specified in the 'mixedlang_vector' library. But this implementation fails for TriBITS packages that only have INTERFACE libraries. Those are never getting added to the <Package>::all_libs target or indirectly to targets that do. This is why the STKEmend package failed because it has just one HEADERONLY INTERFACE library. This new added test case ensures that the INTERFACE library does get linked to the <Package>::all_libs target and will fail if it does not. The next commit will add the code in TriBITS to fix this test :-) Signed-off-by: Roscoe A. Bartlett <[email protected]>
…ub#625) This fixes the previously added failing test :-) Also, this change required the update of some other tests. Now that INTERFACE_LIBRARY taragets are getting pulled down, the <SubPkg>::all_libs for subpackage targets are getting added the <ParentPkg>::all_libs target for parent packages. This is an intereting case but it works. Signed-off-by: Roscoe A. Bartlett <[email protected]>
…ub#625) This fixes the previously added failing test :-) I also had to add logic to not generate the package-config files when doing installation testing where you are only building the tests and examples. This was generating a strange error about export sets. You should not be generating packge-config files in these cases. Also, this change required the update of some other tests. Now that INTERFACE_LIBRARY taragets are getting pulled down, the <SubPkg>::all_libs for subpackage targets are getting added the <ParentPkg>::all_libs target for parent packages. This is an intereting case but it works. Signed-off-by: Roscoe A. Bartlett <[email protected]>
…iBITSPub#625) This failing test shows that an INTERFACE library was not getting picked up and linked to the <Package>::all_libs target. The reason the existing tests all passed after adding the initial support for HEAERONLY INTERFACE libraries was that I added the interface library 'mixedlang_vector' before the main 'mixedlang' library. So the new 'mixedlang_vector' library is getting written to the MixedLangTargets.cmake file and is getting linked to 'mixedlang' and 'mixedlang' was getting liked to MixedLang::all_libs. So, anyone that was linking against MixedLang::all_libs or just the 'mixedlang' LIB (from internal or IMPORTED target) was getting the include directories being specified in the 'mixedlang_vector' library. But this implementation fails for TriBITS packages that only have INTERFACE libraries. Those are never getting added to the <Package>::all_libs target or indirectly to targets that do. This is why the STKEmend package failed because it has just one HEADERONLY INTERFACE library. This new added test case ensures that the INTERFACE library does get linked to the <Package>::all_libs target and will fail if it does not. The next commit will add the code in TriBITS to fix this test :-) Signed-off-by: Roscoe A. Bartlett <[email protected]>
…ub#625) This fixes the previously added failing test :-) I also had to add logic to not generate the package-config files when doing installation testing where you are only building the tests and examples. This was generating a strange error about export sets. You should not be generating packge-config files in these cases. Also, this change required the update of some other tests. Now that INTERFACE_LIBRARY taragets are getting pulled down, the <SubPkg>::all_libs for subpackage targets are getting added the <ParentPkg>::all_libs target for parent packages. This is an intereting case but it works. Signed-off-by: Roscoe A. Bartlett <[email protected]>
Add support for tribits_add_library( ... HEADERONLY ... ) (#625)
FYI: This is needed for: |
This brings in support for tribits_add_library( ... HEADERONLY ...). See TriBITSPub/TriBITS#625. Signed-off-by: Roscoe A. Bartlett <[email protected]>
Description
With the move to modern CMake, it should now be easy to support header-only libraries with
tribits_add_library()
. The idea would be to provide a new keywordHEADERONLY
that would allow theSOURCES <src0> <src1> ...
argument to be missing. Then an interface-only CMake target would get created.The hardest parts of adding this new feature is adding a test case for all of the supported use cases and adding documentation.
Motivating user is the STK package in Trilinos.
The text was updated successfully, but these errors were encountered: