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

Header only subpackage error #51

Closed
hcedwar opened this issue Dec 4, 2014 · 2 comments · Fixed by #626
Closed

Header only subpackage error #51

hcedwar opened this issue Dec 4, 2014 · 2 comments · Fixed by #626

Comments

@hcedwar
Copy link

hcedwar commented Dec 4, 2014

Header only subpackages should be supported.

@bartlettroscoe bartlettroscoe added this to the 1_backlog milestone Dec 4, 2014
@bartlettroscoe bartlettroscoe self-assigned this Dec 4, 2014
@bartlettroscoe
Copy link
Member

The plan would be to provide a simple function like:

TRIBITS_ADD_HEADERS(
  [HEADERS <h0> <h1> ...]
  [HEADERS_INSTALL_SUBDIR <subdir>]
  [NOINSTALLHEADERS <nih0> <hih1> ...]
  )

The option INSTALL_SUBDIR, <subdir> is new. It would allow you to install your headers under <install-dir>/include/<subdir>/ instead of just <install-dir>/include/ like happens now by default. I know some packages like to do this.

What this function would do is:

  1. Add the include directories for to ${PACKAGE_NAME}_INCLUDE_DIRS
  2. Add INSTALL() commands for the headers listed in HEADERS.

Would this satisfy your needs?

@bartlettroscoe bartlettroscoe removed this from the 1_backlog milestone Feb 19, 2016
bartlettroscoe added a commit to trilinos/Trilinos that referenced this issue Dec 8, 2016
This is a trick to give a fully templated package a library.  TriBITS does not
yet support packages with header files but no library (see
TriBITSPub/TriBITS#51).

Now MiniTensor builds and runs the tests.
lxmota pushed a commit to trilinos/Trilinos that referenced this issue Dec 8, 2016
This is a trick to give a fully templated package a library.  TriBITS does not
yet support packages with header files but no library (see
TriBITSPub/TriBITS#51).

Now MiniTensor builds and runs the tests.
lxmota pushed a commit to trilinos/Trilinos that referenced this issue Dec 9, 2016
This is a trick to give a fully templated package a library.  TriBITS does not
yet support packages with header files but no library (see
TriBITSPub/TriBITS#51).

Now MiniTensor builds and runs the tests.
@bartlettroscoe
Copy link
Member

There has been some recent queries about header-only packages and subpackages in TriBITS. The plan described above would work, but it would increase the code and therefore complexity in TriBITS.

The better plan would be to refactor TriBITS to use updated CMake features would directly allow that. The newer add_library( <target-name> ... INTERFACE ... ) option along with targert_add_include_directories() would provide easy direct support for that, and would eliminate a lot of (complex) code in TriBITS that has to manually manage the list of include directories for each SE package.

But the add_library( ... INTERFACE ...) option was only added in CMake 3.0 but currently the Trilinos project requires backward compatibility with CMake 2.8.11 and that version does not support the INTERFACE option as shown at:

It looks like we need to upgrade the minimum version of CMake to at least 3.0 to allow the usage of ADD_LIBRARY(INTERFACE) as shown at:

https://cmake.org/cmake/help/v3.0/command/add_library.html

The current workaround is to create a dummy source file and a dummy library. Several examples of that in Trilinos.

It would be great if we could upgrade the minimum version of CMake required by Trilinos and TriBITS. To chime in on that, please add a comment to:

trilinos/Trilinos#1761

The more recent, the better.

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

Successfully merging a pull request may close this issue.

2 participants