Library Targets Include Directories Broken
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- cmake, cpp
- Ambito
- build-system
Direzione di ricerca
Inizia in cmake/draco_targets.cmake, nella definizione di draco_add_library e nelle chiamate a target_include_directories intorno alle righe 226, 319 e 323. Esamina come viene generato draco/draco_features.h e come vengono utilizzati i target come sottoprogetti o librerie installate. Il lavoro è completato quando i percorsi di inclusione funzionano correttamente sia in fase di compilazione sia in fase di installazione e le macro delle funzionalità sono disponibili per gli utenti della libreria.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hi folks, when using the draco library as a subproject, or with CMake's FetchContent/ExternalProject machinery, the draco includes are broken. This stems from the definition of the draco_add_library macro. Specifically, on line 226, the library target has the INSTALL_INTERFACE set at the include directory of the install folder. This works as intended. However, the BUILD_INTERFACE is not set at any point. Instead on lines 319 and 323 target_include_directories is called again to provide private and public directories, those these are not restricted to build time.
Now, my CMake experience does not include using macro wrappers around the typical target oriented machinery. Instead I am used to the modern CMake style of generator expressions. I worry that producing a large pull request reworking the CMake would not be accepted as it would be difficult to review.
So here is how I would address the issue: All of the library targets use the same build and install include directories. I would replace the referenced lines by the singular block:
target_include_directories(${lib_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src/>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/>
)
Now this doesn't address the generated draco/draco_features.h header, at least at build time. This CMake generated header defines a set of macros describing which features are supported. Instead this should be handled using the target_compile_definitions machinery. By setting these values publicly on the targets, both consumers of the installed library and the build time library will have those macros defined. The header can still be generated for backwards compatibility purposes as well.
- Lingua principale
- C++
- Stelle
- 7.5k
- Fork
- 1.1k
- Merge medio
- 23h 57m
- PR unite (30g)
- 3
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di google/draco
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
documentation low priority
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
-
Test failures on big-endianAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 43/100
Tutte le issue di google/draco
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
mattgodbolt/zindex#67 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
NKI-AI/fastslide#105 · 2 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
DarkCastleMUD/DarkCastle#283 ·
-
Toggle state is unclearAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100