CMake Config uses absolute paths.
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 54/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- cmake
- Área
- build-system
Línea de trabajo
Comienza con CMakeLists.txt e inspecciona cómo las variables de GNUInstallDirs alimentan los archivos generados cjson.cmake, cjson_utils.cmake y cjson-<BUILD_TYPE>.cmake. Compara las importaciones generadas antes y después del cambio de configuración; se considera terminado cuando se puede encontrar un paquete cJSON instalado desde otro prefijo de instalación sin rutas codificadas.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Out of the box it is not possible to import cjson using find_package cmake command If you have not build the library yourself. This is due to the CMakeLists.txt file using CMAKE_INSTALL_FULL_* variables from GNUInstallDirs module which according to the documentation should not be used on install() commands.
In any case the fix is simple, just replace CMAKE_INSTALL_FULL_* variables with their relative counterparts (i.e., CMAKE_INSTALL_LIBDIR, CMAKE_INSTALL_BINDIR, etc.)
If you want a little bit more detail. What happens is that if you use the FULL variables in install commands. The cmake config files will use the FULL path as the installation prefix instead of calculating the path at runtime base on the file location. You can see this in the cjson.cmake file (more or less line 48) and in cjson_utils.cmake where when using the FULL variant the code looks like this:
# The installation prefix configured by this project.
set(_IMPORT_PREFIX "/<my-person-install>/cjson/cjson-1.7.19/")
While when using the relative paths it looks like this:
# Compute the installation prefix relative to this file.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
set(_IMPORT_PREFIX "")
endif()
You can also see it on the cjson-<BUILD_TYPE>.cmake Where the IMPORTED_LOCATION_<BUILD_TYPE> will be the FULL path and if using the relative path variables it will just use the calculated _IMPORT_PREFIX instead.
If you want I can make a pull request with this simple fix. 😅
PS. This does not affect CJSON_INCLUDE_DIRS and CJSON_INCLUDE_DIR variables. Those still have the full path.
- Lenguaje dominante
- C
- Estrellas
- 13k
- Forks
- 3.5k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de DaveGamble/cJSON
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
DaveGamble/cJSON#1094 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
DaveGamble/cJSON#1093 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
DaveGamble/cJSON#1082 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
DaveGamble/cJSON#1081 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
DaveGamble/cJSON#1074 ·
Todos los issues de DaveGamble/cJSON
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
Failed to resolve logo sourceAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
fastfetch-cli/fastfetch#2628 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
FujiNetWIFI/fujinet-firmware#1736 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100