Howto find header-only libraries properly

Abierto
#64 3 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
cmake
Área
build-system

Línea de trabajo

Comienza con los ejemplos del issue de Boost::headers y find_package(Boost 1.84.0 REQUIRED headers), y después compara los metadatos de CMake para compilaciones de Boost como subproject, CMake externo y B2. Se considera terminado cuando el proyecto tenga una forma acordada y preparada para el futuro de descubrir bibliotecas header-only en los tres entornos.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

I am not sure if this is the right place to ask this question, but since it's CMake related, i give it a try.

First some background, i am using CMake to build my projects, most of my projects link against an installed Boost library, only very few projects compile a private version of Boost themself during their build and link against this one. Until recently i was using only B2 builds of Boost, but now i switched to CMake builds, mostly to profit of the transitive dependency resolution to reduce compilation for projects that build Boost themself. Of course i was hit by the problem that the target Boost::headers does nothing in that case and i have to link against header-only libraries directly.

Now i'm facing the difficulty that a big library of mine has to work in both environments, Boost as subproject and an external Boost. To find the external Boost header-only libraries i use the usual find_package(Boost 1.84.0 REQUIRED headers) call, this gives me Boost::headers to link against. This target also exists when using Boost as subproject, but in that case it is not IMPORTED. My first idea was, check if that target is IMPORTED, use it in that case, otherwise link against indiviual libraries. Doesn't look nice, but would work.

Looking at the CMake metadata of a CMake Boost build i saw that there is code to actually create targets for individual header-only libraries, but for this to get actually used, i also have to search for these libraries explicit like find_package(Boost 1.84.0 REQUIRED asio smart_ptr). I like that approach but there is one problem, this does not work for a B2 build, that one does not contain targets for individual header-only libraries.

Now i wonder, what would be a future proof way to search for header-only libraries?

Lenguaje dominante
CMake
Estrellas
119
Forks
38
Merge medio
10 h 51 min
PR fusionados (30 d)
1

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de boostorg/cmake

Todos los issues de boostorg/cmake

Issues similares

Más issues de Build System

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.