boostorg / boostorg/gil

Move operations only relevant for test out of main CMakeLists.txt

Aperta
#168 6 commenti 0 reazioni 1 assegnatario Rivendicata da @mloskot Vedi su GitHub
config/cmake status/need-feedback status/work-in-progress
Lingua principale
C++
Stelle
199
Fork
171
Merge medio
1g 14h
PR unite (30g)
10

Descrizione

Just a comment based on my person preference and experience:

I'd recommend moving all the compiler-flags and other machinery that are not necessary for using the library itself into the respective CMakeLists.txt files where they are actually needed.

This is more relevant, when you provide a cmake target (see https://github.com/boostorg/gil/issues/167) and/or have to compile your library, but even if not, I generally prefer to put compiler options next to the targets they are actually relevant for. E.g. `Boost::unit_test_framework` is afaik only needed when you want to run the unit-tests. So it imho should only be looked up when `gil/test/CMakeLists.txt` gets actually included (e.g. not if `GIL_BUILD_TESTS == OFF`). Same with things like `/Wall` or `CMAKE_CXX_STANDARD 11`.

Even if you are not defining a cmake library target (for which you should definetifely not set public warning level flags) it makes it easier for me to discover, which flags I have to set in my project when I want to use this library, vs what flags you are using in order to find bugs in the implementation.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.