AcademySoftwareFoundation / AcademySoftwareFoundation/OpenColorIO

OpenColorIO skips find_package for some 3rd party dependencies when "PackageName_ROOT" is defined

Aperta
#2,185 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C++
Stelle
2.1k
Fork
503
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

OpenColorIO has some 3rd party dependencies for which custom "FindPackageName.cmake" files have been written. Examples: yaml-cpp, Imath, minizip-ng,... These all check if the "PackageName_ROOT" variable is defined and if not they call find_package(PackageName).
For example for yaml-cpp:

```
# Search for yaml-cpp-config.cmake
if(NOT DEFINED yaml-cpp_ROOT)
find_package(yaml-cpp ${yaml-cpp_FIND_VERSION} CONFIG ${quiet})
endif()
```

The [CMake documentation of find_package](https://cmake.org/cmake/help/latest/command/find_package.html) states however that the location referred to by the variable "PackageName_ROOT" is searched first to find the package. In our build setup we do set this variable so that find_package commands will find the appropriate version (i.e., the one we build from source). Because of "if(NOT DEFINED...)" the find_package call is skipped in this case, which is unexpected behavior for us.

What is the reasoning behind this implementation? At first sight it doesn't seem to comply with the CMake docs.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia ispezionando le implementazioni personalizzate di FindPackageName.cmake menzionate nell’issue, in particolare l’esempio yaml-cpp, e confronta i relativi guard PackageName_ROOT con la documentazione di CMake su find_package. Determina se il guard è intenzionale e chiarisci il comportamento previsto; il completamento dovrebbe risolvere la questione sollevata nell’issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cmake, cpp
Ambito
build-system
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.