[Openmp-commits] [PATCH] D134275: [OpenMP] [OMPD] Build gdb-plugin code only when python3 development files are available.

Michał Górny via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Sep 22 08:57:43 PDT 2022


mgorny added inline comments.


================
Comment at: openmp/libompd/CMakeLists.txt:11-17
+set(LIBOMP_OMPD_GDB_SUPPORT FALSE CACHE BOOL
+        "Build gdb-plugin code that enables OMPD support in GDB.")
+
+find_package (Python3 COMPONENTS Interpreter Development)
+if (Python3_INCLUDE_DIRS AND Python3_LIBRARIES)
+    set(LIBOMP_OMPD_GDB_SUPPORT TRUE)
+endif()
----------------
Vigneshbalu wrote:
> mgorny wrote:
> > Vigneshbalu wrote:
> > > mgorny wrote:
> > > > aaronpuchert wrote:
> > > > > Use `Python3_FOUND` (see [docs](https://cmake.org/cmake/help/latest/module/FindPython3.html#result-variables)).
> > > > I think `option()` is better for booleans.
> > > > 
> > > > https://cmake.org/cmake/help/latest/command/option.html
> > > `Python3_Development_FOUND` might be more suitable  But i wonder whether it will be true when one of the artifacts was absent in rare scenario. Example `Python3_INCLUDE_DIR `is present but not `Python3_LIBRARY`
> > > I  assumed this would be safest.
> > `Python3_FOUND` is `FALSE` if *any* of the requested components are missing. It's easy enough to check by renaming `/usr/include/python3.x` .
> I can see `Python3_FOUND` is false if i rename `/usr/include/python3.x`.  However same is not true if i rename `/usr/lib/x86_64-linux-gnu/libpython3.x.so` . Even `Python3_Development_FOUND` doesn't work for above case.
> 
> this if check `if (Python3_INCLUDE_DIRS AND Python3_LIBRARIES)`  also works fine with configuration  if i rename library and fails at runtime.
> 
> I couldn't see any other reference anywhere in llvm-repo.
> Am i missing something here ?
> 
> 
> 
It returns `FALSE` for me w/ CMake 3.24.2.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134275/new/

https://reviews.llvm.org/D134275



More information about the Openmp-commits mailing list