Repository: spack/spack

Issue:
Installation issue: qt-base is missing OpenGL
### Steps to reproduce the issue

```console
$ spack spec qt-base   
Input spec
--------------------------------
 -   qt-base

Concretized
--------------------------------
 -   qt-base@6.5.1%gcc@12.3.1~accessibility~dbus~framework~gtk+gui~ipo~network~opengl+shared+sql+widgets build_system=cmake build_type=Release generator=ninja arch=linux-fedora37-x86_64
[+]      ^cmake@3.26.3%gcc@12.3.1~doc+ncurses+ownlibs~qt build_system=generic build_type=Release arch=linux-fedora37-x86_64
[+]          ^ncurses@6.4%gcc@12.3.1~symlinks+termlib abi=none build_system=autotools arch=linux-fedora37-x86_64
[+]          ^openssl@1.1.1u%gcc@12.3.1~docs~shared build_system=generic certs=mozilla arch=linux-fedora37-x86_64
[-]              ^ca-certificates-mozilla@2023-01-10%gcc@12.3.1 build_system=generic arch=linux-fedora37-x86_64
[+]              ^perl@5.38.0%gcc@12.3.1+cpanm+open+shared+threads build_system=generic arch=linux-fedora37-x86_64
[+]                  ^berkeley-db@18.1.40%gcc@12.3.1+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-fedora37-x86_64
[+]      ^double-conversion@3.3.0%gcc@12.3.1~ipo build_system=cmake build_type=Release generator=make arch=linux-fedora37-x86_64
[+]          ^gmake@4.4.1%gcc@12.3.1~guile build_system=autotools arch=linux-fedora37-x86_64
[+]      ^fontconfig@2.14.2%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]          ^font-util@1.4.0%gcc@12.3.1 build_system=autotools fonts=encodings,font-adobe-100dpi,font-adobe-75dpi,font-adobe-utopia-100dpi,font-adobe-utopia-75dpi,font-adobe-utopia-type1,font-alias,font-arabic-misc,font-bh-100dpi,font-bh-75dpi,font-bh-lucidatypewriter-100dpi,font-bh-lucidatypewriter-75dpi,font-bh-type1,font-bitstream-100dpi,font-bitstream-75dpi,font-bitstream-speedo,font-bitstream-type1,font-cronyx-cyrillic,font-cursor-misc,font-daewoo-misc,font-dec-misc,font-ibm-type1,font-isas-misc,font-jis-misc,font-micro-misc,font-misc-cyrillic,font-misc-ethiopic,font-misc-meltho,font-misc-misc,font-mutt-misc,font-schumacher-misc,font-screen-cyrillic,font-sun-misc,font-winitzki-cyrillic,font-xfree86-type1 arch=linux-fedora37-x86_64
[+]              ^autoconf@2.69%gcc@12.3.1 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-fedora37-x86_64
[+]              ^automake@1.16.5%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[-]              ^bdftopcf@1.1%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[-]                  ^fontsproto@2.1.3%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[-]                  ^libxfont@1.5.4%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[-]              ^mkfontdir@1.0.7%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[-]              ^mkfontscale@1.2.2%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[-]                  ^libfontenc@1.1.7%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]          ^gperf@3.1%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]          ^util-linux-uuid@2.38.1%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]      ^freetype@2.11.1%gcc@12.3.1+pic+shared build_system=autotools arch=linux-fedora37-x86_64
[+]          ^bzip2@1.0.8%gcc@12.3.1~debug~pic+shared build_system=generic arch=linux-fedora37-x86_64
[+]              ^diffutils@3.9%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]      ^harfbuzz@7.3.0%gcc@12.3.1~graphite2~strip build_system=meson buildtype=release default_library=shared arch=linux-fedora37-x86_64
[+]          ^cairo@1.16.0%gcc@12.3.1+X+fc+ft+gobject+pdf~png~svg build_system=autotools patches=7c4da77 arch=linux-fedora37-x86_64
[+]              ^libtool@2.4.7%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]              ^libxext@1.3.3%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]              ^m4@1.4.19%gcc@12.3.1+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-fedora37-x86_64
[+]                  ^libsigsegv@2.14%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]              ^pixman@0.42.2%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]              ^which@2.21%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]          ^glib@2.76.3%gcc@12.3.1~libmount~strip build_system=meson buildtype=release default_library=shared tracing=none arch=linux-fedora37-x86_64
[+]              ^elfutils@0.189%gcc@12.3.1~debuginfod+nls build_system=autotools arch=linux-fedora37-x86_64
[+]          ^gobject-introspection@1.76.1%gcc@12.3.1~strip build_system=meson buildtype=release default_library=shared arch=linux-fedora37-x86_64
[+]              ^flex@2.6.3%gcc@12.3.1+lex~nls build_system=autotools arch=linux-fedora37-x86_64
[+]                  ^findutils@4.9.0%gcc@12.3.1 build_system=autotools patches=440b954 arch=linux-fedora37-x86_64
[+]          ^meson@1.1.0%gcc@12.3.1 build_system=python_pip patches=0f0b1bd arch=linux-fedora37-x86_64
[+]              ^py-pip@23.1.2%gcc@12.3.1 build_system=generic arch=linux-fedora37-x86_64
[+]              ^py-setuptools@67.6.0%gcc@12.3.1 build_system=generic arch=linux-fedora37-x86_64
[+]              ^py-wheel@0.37.1%gcc@12.3.1 build_system=generic arch=linux-fedora37-x86_64
[+]      ^icu4c@67.1%gcc@12.3.1 build_system=autotools cxxstd=11 arch=linux-fedora37-x86_64
[+]      ^libdrm@2.4.115%gcc@12.3.1~docs build_system=generic arch=linux-fedora37-x86_64
[+]          ^libpciaccess@0.17%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]          ^libpthread-stubs@0.4%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]      ^libjpeg-turbo@2.1.5%gcc@12.3.1~ipo~jpeg8+shared+static build_system=cmake build_type=Release generator=make arch=linux-fedora37-x86_64
[-]          ^nasm@2.15.05%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]      ^libpng@1.6.39%gcc@12.3.1~ipo build_system=cmake build_type=Release generator=make libs=shared,static arch=linux-fedora37-x86_64
[+]      ^libxcb@1.14%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]          ^libxau@1.0.8%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]              ^xproto@7.0.31%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]          ^libxdmcp@1.1.4%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]              ^libbsd@0.11.7%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]                  ^libmd@1.0.4%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]          ^util-macros@1.19.3%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]          ^xcb-proto@1.15.2%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]      ^libxkbcommon@1.4.0%gcc@12.3.1~strip~wayland build_system=meson buildtype=release default_library=shared arch=linux-fedora37-x86_64
[+]          ^bison@3.8.2%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]          ^xkbdata@1.0.1%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]              ^xkbcomp@1.4.4%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]                  ^libxkbfile@1.0.9%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]      ^libxml2@2.10.3%gcc@12.3.1~python build_system=autotools arch=linux-fedora37-x86_64
[+]          ^libiconv@1.17%gcc@12.3.1 build_system=autotools libs=shared,static arch=linux-fedora37-x86_64
[+]          ^xz@5.4.1%gcc@12.3.1~pic build_system=autotools libs=shared,static arch=linux-fedora37-x86_64
[+]      ^libxrender@0.9.10%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]          ^libx11@1.8.4%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]              ^inputproto@2.3.2%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]              ^kbproto@1.0.7%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]              ^xextproto@7.3.0%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]              ^xtrans@1.4.0%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]          ^renderproto@0.11.1%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]      ^ninja@1.11.1%gcc@12.3.1+re2c build_system=generic arch=linux-fedora37-x86_64
[+]          ^re2c@2.2%gcc@12.3.1 build_system=generic arch=linux-fedora37-x86_64
[+]      ^pcre2@10.42%gcc@12.3.1~jit+multibyte build_system=autotools arch=linux-fedora37-x86_64
[+]      ^pkgconf@1.9.5%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]      ^python@3.10.12%gcc@12.3.1+bz2+crypt+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tkinter+uuid+zlib build_system=generic patches=0d98e93,7d40923,f2fd060 arch=linux-fedora37-x86_64
[+]          ^expat@2.5.0%gcc@12.3.1+libbsd build_system=autotools arch=linux-fedora37-x86_64
[+]          ^gdbm@1.23%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]          ^gettext@0.21.1%gcc@12.3.1+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-fedora37-x86_64
[+]              ^tar@1.34%gcc@12.3.1 build_system=autotools zip=pigz arch=linux-fedora37-x86_64
[+]                  ^pigz@2.7%gcc@12.3.1 build_system=makefile arch=linux-fedora37-x86_64
[+]          ^libffi@3.4.4%gcc@12.3.1 build_system=autotools arch=linux-fedora37-x86_64
[+]          ^libxcrypt@4.4.35%gcc@12.3.1~obsolete_api build_system=autotools patches=4885da3 arch=linux-fedora37-x86_64
[+]          ^readline@8.2%gcc@12.3.1 build_system=autotools patches=bbf97f1 arch=linux-fedora37-x86_64
[+]      ^sqlite@3.42.0%gcc@12.3.1+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=linux-fedora37-x86_64
[+]      ^zlib@1.2.13%gcc@12.3.1+optimize+pic+shared build_system=makefile arch=linux-fedora37-x86_64
[+]      ^zstd@1.5.5%gcc@12.3.1+programs build_system=makefile compression=none libs=shared,static arch=linux-fedora37-x86_64
```


### Error message

As requested in #32696 
ping @wdconinc, @sethrj 

`qt-base` does not build with the error:

<pre>
ERROR: The OpenGL functionality tests failed! You might need to modify the OpenGL package search path by setting the OpenGL_DIR CMake variable to the OpenGL library's installation directory.
</pre>

<details><summary>Full error log</summary>

```
==> qt-base: Executing phase: 'cmake'
==> [2023-07-10-02:03:37.821032] '$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/cmake-3.26.3-6yimixzo6nsao5w4jwvgdgrfyxlaiwqa/bin/cmake' '-G' 'Ninja' '-DCMAKE_INSTALL_PREFIX:STRING=$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/qt-base-6.5.1-gygoysbioo4woviqoikdtpqzanqo67l4' '-DCMAKE_BUILD_TYPE:STRING=Release' '-DBUILD_TESTING:BOOL=ON' '-DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=OFF' '-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON' '-DCMAKE_INSTALL_RPATH:STRING=$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/qt-base-6.5.1-gygoysbioo4woviqoikdtpqzanqo67l4/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/qt-base-6.5.1-gygoysbioo4woviqoikdtpqzanqo67l4/lib64;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/fontconfig-2.14.2-doiuyl4w3ujmasw3nhhklddjvyyaozyt/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/font-util-1.4.0-vzz3lumlsfkcy7ygdniayfdninewbser/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/freetype-2.11.1-afk2jssvkdmd7pvmmas53nsh35q3njff/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/bzip2-1.0.8-exv4urenhfnzxoa4536rioy6bgbfglvv/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libpng-1.6.39-ck33z36qth4ikwsiik7qzf6vzijaxw4s/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/zlib-1.2.13-uex44uq55uqoq34xmkh3kibt6mvi3fhz/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libxml2-2.10.3-hg7lws3qg5u5f2hegyq7swqpirdoai7s/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libiconv-1.17-zh4qqfvo3yxlgcorqje4nlsrlednmrdo/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/xz-5.4.1-umxjpbvxuupk5xoqv5nfsupm3frtnrlz/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/util-linux-uuid-2.38.1-kjjkborl6prdo6io6fs2u452om6hwz2c/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/harfbuzz-7.3.0-uehenjxde6hd3hxs4i6tfhwfkez2vv3c/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/cairo-1.16.0-op7liezmjexd6dzmtwlibiyqugui7zwh/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/glib-2.76.3-5cjrwef6wr5jaslt7icihc55qfucsghj/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/elfutils-0.189-dggubta7ldqpqb5rs45om3w7c4c3stgz/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/gettext-0.21.1-isqviehrevk5lh2czgq2pnn6aony4qfz/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/ncurses-6.4-odrr6fhv5sxipuaztco6cejnjcdpmphn/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/pkgconf-1.9.5-l6dygzvqfq6zt7scexun2pzzabcztpbe/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/zstd-1.5.5-e2xb5gamzktaj6tqthb7y6424nm55ert/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libffi-3.4.4-o4krhgkjk2y2k2rki6vy3deurpcwdoaa/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/pcre2-10.42-td2v6nihufnizjkb66ybewapr4qcvljf/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libx11-1.8.4-ftl5k54wutvrl4mw7a6x3dvbkvg3n2xa/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/inputproto-2.3.2-bqq2yo4hyed2h2e6b5cvtq4ojbxch52e/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/kbproto-1.0.7-3kdmmnt6whd2i34oj7cbceyoesnjcv6b/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libxcb-1.14-y77opgag7myhygi35f7pciu3nhvw7zqv/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libpthread-stubs-0.4-rlsdm76m7ub7s4j5rhwhojlrbib7dsd6/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libxau-1.0.8-lyiosylly4vefkpmxhmclrgkx2suo7bw/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/xproto-7.0.31-nwwqt6mz4stxn2pyasbisebjhqcpxalw/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libxdmcp-1.1.4-mp2sarrtufic52zgmyf6sytwbinkpfya/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libbsd-0.11.7-5aotgs2qpxknhsyn3u7vt62c7lrwpgnq/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libmd-1.0.4-m2oo3gmxpyphervrjttrzznh3wv7comp/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/xcb-proto-1.15.2-6kef5qtw7ixwyam3wlzpjgdtrs3er2jw/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/xextproto-7.3.0-2lcpio3am5fbxwgnaufotopkh74wrwm5/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libxext-1.3.3-hduu7gqr3lqap5i2zjn3cpw4dq6sreel/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libxrender-0.9.10-xec5abyjikmncvosfo55y54srbbqqyxt/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/renderproto-0.11.1-rfywrzbfkcgozvivdigoa37udqdlmzam/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/pixman-0.42.2-ix6lbwb5nhpw2srdkdzmcpur46qtflw2/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/gobject-introspection-1.76.1-kvkndbep2dpabmkmkhjfls5vep5rwjiu/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/python-3.10.12-hp7z6hwgrccbe7tym2bb2if7cpzfbfbz/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/expat-2.5.0-ams43t7cednppyo4sbnwhgdbyncgk4wp/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/gdbm-1.23-nj2to2anfq73tly74uff3pf3c6s356pz/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/readline-8.2-byyqljlghzikorbgb3w4v747xat25ubi/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libxcrypt-4.4.35-gqnkjknleoril327jeif5ul6w4ov7bq7/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/openssl-1.1.1u-krqvjxivd4gciv4nz75nosapr6puv2xb/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/sqlite-3.42.0-nk2o5o7bp3nttfz4onx6tnczbttymnrw/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/icu4c-67.1-i4bmkczded7elx2noupoz2ksf2oalzbt/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libdrm-2.4.115-usqxd2s5akwe3ksq3jv574hbhusksb2t/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libpciaccess-0.17-537watvfgtw573bp7v3cjq6skprskj63/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libxkbcommon-1.4.0-qhgcdr5fl6d7tvzbgm2rih3u7z2wm5mp/lib;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/double-conversion-3.3.0-pv6choros4gr2lturlcjughjfaowgo5o/lib64;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libpng-1.6.39-ck33z36qth4ikwsiik7qzf6vzijaxw4s/lib64;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libffi-3.4.4-o4krhgkjk2y2k2rki6vy3deurpcwdoaa/lib64;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libjpeg-turbo-2.1.5-p4eqqv2u42wn4v7yisvub73hqrb7ujty/lib64' '-DCMAKE_PREFIX_PATH:STRING=$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libxkbcommon-1.4.0-qhgcdr5fl6d7tvzbgm2rih3u7z2wm5mp;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/xkbdata-1.0.1-f54qygawljj5f7wqh2vcfezwhs66ni24;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libjpeg-turbo-2.1.5-p4eqqv2u42wn4v7yisvub73hqrb7ujty;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libdrm-2.4.115-usqxd2s5akwe3ksq3jv574hbhusksb2t;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libpciaccess-0.17-537watvfgtw573bp7v3cjq6skprskj63;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/harfbuzz-7.3.0-uehenjxde6hd3hxs4i6tfhwfkez2vv3c;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/icu4c-67.1-i4bmkczded7elx2noupoz2ksf2oalzbt;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/gobject-introspection-1.76.1-kvkndbep2dpabmkmkhjfls5vep5rwjiu;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/cairo-1.16.0-op7liezmjexd6dzmtwlibiyqugui7zwh;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/pixman-0.42.2-ix6lbwb5nhpw2srdkdzmcpur46qtflw2;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libxrender-0.9.10-xec5abyjikmncvosfo55y54srbbqqyxt;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/renderproto-0.11.1-rfywrzbfkcgozvivdigoa37udqdlmzam;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libxext-1.3.3-hduu7gqr3lqap5i2zjn3cpw4dq6sreel;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libx11-1.8.4-ftl5k54wutvrl4mw7a6x3dvbkvg3n2xa;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/xextproto-7.3.0-2lcpio3am5fbxwgnaufotopkh74wrwm5;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libxcb-1.14-y77opgag7myhygi35f7pciu3nhvw7zqv;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/xcb-proto-1.15.2-6kef5qtw7ixwyam3wlzpjgdtrs3er2jw;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libxdmcp-1.1.4-mp2sarrtufic52zgmyf6sytwbinkpfya;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libxau-1.0.8-lyiosylly4vefkpmxhmclrgkx2suo7bw;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libpthread-stubs-0.4-rlsdm76m7ub7s4j5rhwhojlrbib7dsd6;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/kbproto-1.0.7-3kdmmnt6whd2i34oj7cbceyoesnjcv6b;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/inputproto-2.3.2-bqq2yo4hyed2h2e6b5cvtq4ojbxch52e;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/glib-2.76.3-5cjrwef6wr5jaslt7icihc55qfucsghj;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/pcre2-10.42-td2v6nihufnizjkb66ybewapr4qcvljf;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/ninja-1.11.1-kbz27kxoiq6wv4ngqyxojh5qg3z4tkew;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/elfutils-0.189-dggubta7ldqpqb5rs45om3w7c4c3stgz;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/fontconfig-2.14.2-doiuyl4w3ujmasw3nhhklddjvyyaozyt;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/python-3.10.12-hp7z6hwgrccbe7tym2bb2if7cpzfbfbz;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/util-linux-uuid-2.38.1-kjjkborl6prdo6io6fs2u452om6hwz2c;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/sqlite-3.42.0-nk2o5o7bp3nttfz4onx6tnczbttymnrw;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libxcrypt-4.4.35-gqnkjknleoril327jeif5ul6w4ov7bq7;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libffi-3.4.4-o4krhgkjk2y2k2rki6vy3deurpcwdoaa;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/gettext-0.21.1-isqviehrevk5lh2czgq2pnn6aony4qfz;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/tar-1.34-xiapisc44l73hhkniiea5m54bsvpkvya;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/zstd-1.5.5-e2xb5gamzktaj6tqthb7y6424nm55ert;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/expat-2.5.0-ams43t7cednppyo4sbnwhgdbyncgk4wp;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libbsd-0.11.7-5aotgs2qpxknhsyn3u7vt62c7lrwpgnq;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libmd-1.0.4-m2oo3gmxpyphervrjttrzznh3wv7comp;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libxml2-2.10.3-hg7lws3qg5u5f2hegyq7swqpirdoai7s;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/xz-5.4.1-umxjpbvxuupk5xoqv5nfsupm3frtnrlz;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/font-util-1.4.0-vzz3lumlsfkcy7ygdniayfdninewbser;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/xtrans-1.4.0-6t5jpmh653bnjnjy5jcnvkh66zsidsl3;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/xproto-7.0.31-nwwqt6mz4stxn2pyasbisebjhqcpxalw;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/freetype-2.11.1-afk2jssvkdmd7pvmmas53nsh35q3njff;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libpng-1.6.39-ck33z36qth4ikwsiik7qzf6vzijaxw4s;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/util-macros-1.19.3-rhbo7ov2wtf43lvv3hh7acplwa5cssoa;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/double-conversion-3.3.0-pv6choros4gr2lturlcjughjfaowgo5o;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/cmake-3.26.3-6yimixzo6nsao5w4jwvgdgrfyxlaiwqa;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/openssl-1.1.1u-krqvjxivd4gciv4nz75nosapr6puv2xb;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/zlib-1.2.13-uex44uq55uqoq34xmkh3kibt6mvi3fhz;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/gdbm-1.23-nj2to2anfq73tly74uff3pf3c6s356pz;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/readline-8.2-byyqljlghzikorbgb3w4v747xat25ubi;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/bzip2-1.0.8-exv4urenhfnzxoa4536rioy6bgbfglvv;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/libiconv-1.17-zh4qqfvo3yxlgcorqje4nlsrlednmrdo;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/ncurses-6.4-odrr6fhv5sxipuaztco6cejnjcdpmphn;$spack/opt/spack/linux-fedora37-x86_64/gcc-12.3.1/pkgconf-1.9.5-l6dygzvqfq6zt7scexun2pzzabcztpbe' '-DQT_ADDITIONAL_PACKAGES_PREFIX_PATH:STRING=' '-DBUILD_SHARED_LIBS:BOOL=ON' '-DFEATURE_optimize_size:BOOL=OFF' '-DFEATURE_accessibility:BOOL=OFF' '-DFEATURE_dbus:BOOL=OFF' '-DFEATURE_framework:BOOL=OFF' '-DFEATURE_gui:BOOL=ON' '-DFEATURE_network:BOOL=OFF' '-DFEATURE_widgets:BOOL=ON' '-DFEATURE_sql:BOOL=ON' '-DINPUT_doubleconversion:STRING=system' '-DINPUT_sqlite:STRING=system' '-DFEATURE_system_doubleconversion:BOOL=ON' '-DFEATURE_system_pcre2:BOOL=ON' '-DFEATURE_system_zlib:BOOL=ON' '-DFEATURE_system_libb2:BOOL=OFF' '-DFEATURE_system_jpeg:BOOL=ON' '-DFEATURE_system_png:BOOL=ON' '-DFEATURE_system_sqlite:BOOL=ON' '-DFEATURE_system_freetype:BOOL=ON' '-DFEATURE_system_harfbuzz:BOOL=ON' '-DFEATURE_system_textmarkdownreader:BOOL=OFF' '-DFEATURE_system_xcb_xinput:BOOL=ON' '$spack-stage/spack-stage-qt-base-6.5.1-gygoysbioo4woviqoikdtpqzanqo67l4/spack-src'
-- The CXX compiler identification is GNU 12.3.1
-- The C compiler identification is GNU 12.3.1
-- The ASM compiler identification is GNU
-- Found assembler: $spack/lib/spack/env/gcc/gcc
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: $spack/lib/spack/env/gcc/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: $spack/lib/spack/env/gcc/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
            -DCMAKE_C_FLAGS_DEBUG=-g
            -DCMAKE_C_FLAGS_RELEASE=-O3 -DNDEBUG
            -DCMAKE_C_FLAGS_RELWITHDEBINFO=-O2 -g -DNDEBUG
            -DCMAKE_CXX_FLAGS_DEBUG=-g
            -DCMAKE_CXX_FLAGS_RELEASE=-O3 -DNDEBUG
            -DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-O2 -g -DNDEBUG
            -DCMAKE_OBJCOPY=/usr/bin/objcopy
            -DCMAKE_C_STANDARD=11
            -DCMAKE_C_STANDARD_REQUIRED=ON
            -DCMAKE_CXX_STANDARD=17
            -DCMAKE_CXX_STANDARD_REQUIRED=ON
            -DCMAKE_MODULE_PATH:STRING=$spack-stage/spack-stage-qt-base-6.5.1-gygoysbioo4woviqoikdtpqzanqo67l4/spack-src/cmake/platforms

-- Configuration summary shown below. It has also been written to $spack-stage/spack-stage-qt-base-6.5.1-gygoysbioo4woviqoikdtpqzanqo67l4/spack-build-gygoysb/config.summary
-- Configure with --log-level=STATUS or higher to increase CMake's message verbosity. The log level does not persist across reconfigurations.

-- Configure summary:

Building for: linux-g++ (x86_64, CPU features: mmx sse sse2)
Compiler: gcc 12.3.1
Build options:
  Mode ................................... release
  Optimize release build for size ........ no
  Fully optimize release builds (-O3) .... no
  Building shared libraries .............. yes
  Using C standard ....................... C11
  Using C++ standard ..................... C++17
  Using ccache ........................... no
  Using new DTAGS ........................ yes
  Relocatable ............................ yes
  Using precompiled headers .............. yes
  Using Link Time Optimization (LTCG) .... no
  Using Intel CET ........................ no
  Target compiler supports:
    x86 Intrinsics ....................... Basic VAES AVX512VBMI2
  Sanitizers:
    Addresses ............................ no
    Threads .............................. no
    Memory ............................... no
    Fuzzer (instrumentation only) ........ no
    Undefined ............................ no
  Build parts ............................ libs tools
Qt modules and options:
  Qt Concurrent .......................... yes
  Qt D-Bus ............................... no
  Qt D-Bus directly linked to libdbus .... no
  Qt Gui ................................. yes
  Qt Network ............................. no
  Qt PrintSupport ........................ yes
  Qt Sql ................................. yes
  Qt Testlib ............................. yes
  Qt Widgets ............................. yes
  Qt Xml ................................. yes
Support enabled for:
  Using pkg-config ....................... yes
  udev ................................... no
  OpenSSL ................................ yes
    Qt directly linked to OpenSSL ........ no
  OpenSSL 1.1 ............................ yes
  OpenSSL 3.0 ............................ no
  Using system zlib ...................... yes
  Zstandard support ...................... yes
  Thread support ......................... yes
Common build options:
  Linker can resolve circular dependencies  yes
Qt Core:
  backtrace .............................. yes
  DoubleConversion ....................... yes
    Using system DoubleConversion ........ yes
  GLib ................................... yes
  ICU .................................... yes
  Using system libb2 ..................... no
  Built-in copy of the MIME database ..... yes
  cpp/winrt base ......................... no
  Tracing backend ........................ <none>
  Logging backends:
    journald ............................. no
    syslog ............................... no
    slog2 ................................ no
  PCRE2 .................................. yes
    Using system PCRE2 ................... yes
  CLONE_PIDFD support in forkfd .......... yes
  Application permissions ................ no
Qt Sql:
  SQL item models ........................ yes
Core tools:
  Android deployment tool ................ yes
  macOS deployment tool .................. no
  Windows deployment tool ................ no
  qmake .................................. yes
Qt Gui:
  Accessibility .......................... no
  FreeType ............................... yes
    Using system FreeType ................ yes
  HarfBuzz ............................... yes
    Using system HarfBuzz ................ yes
  Fontconfig ............................. yes
  Image formats:
    GIF .................................. yes
    ICO .................................. yes
    JPEG ................................. yes
      Using system libjpeg ............... yes
    PNG .................................. yes
      Using system libpng ................ yes
  Text formats:
    HtmlParser ........................... yes
    CssParser ............................ yes
    OdfWriter ............................ yes
    MarkdownReader ....................... yes
      Using system libmd4c ............... no
    MarkdownWriter ....................... yes
  EGL .................................... no
  OpenVG ................................. no
  OpenGL:
    Desktop OpenGL ....................... no
    OpenGL ES 2.0 ........................ no
    OpenGL ES 3.0 ........................ no
    OpenGL ES 3.1 ........................ no
    OpenGL ES 3.2 ........................ no
  Vulkan ................................. no
  Session Management ..................... yes
Features used by QPA backends:
  evdev .................................. yes
  libinput ............................... no
  HiRes wheel support in libinput ........ no
  INTEGRITY HID .......................... no
  mtdev .................................. no
  tslib .................................. no
  xkbcommon .............................. yes
  X11 specific:
    XLib ................................. yes
    XCB Xlib ............................. yes
    EGL on X11 ........................... no
    xkbcommon-x11 ........................ yes
    xcb-sm ............................... no
QPA backends:
  DirectFB ............................... no
  EGLFS .................................. no
  EGLFS details:
    EGLFS OpenWFD ........................ no
    EGLFS i.Mx6 .......................... no
    EGLFS i.Mx6 Wayland .................. no
    EGLFS RCAR ........................... no
    EGLFS EGLDevice ...................... no
    EGLFS GBM ............................ no
    EGLFS VSP2 ........................... no
    EGLFS Mali ........................... no
    EGLFS Raspberry Pi ................... no
    EGLFS X11 ............................ no
  LinuxFB ................................ yes
  VNC .................................... no
  VK_KHR_display ......................... no
  QNX:
    lgmon ................................ no
    IMF .................................. no
  XCB:
    Using system-provided xcb-xinput ..... no
    GL integrations:
      GLX Plugin ......................... no
        XCB GLX .......................... no
      EGL-X11 Plugin ..................... no
  Windows:
    Direct 2D ............................ no
    Direct 2D 1.1 ........................ no
    DirectWrite .......................... no
    DirectWrite 3 ........................ no
Qt Widgets:
  GTK+ ................................... no
  Styles ................................. Fusion Windows
Qt Testlib:
  Tester for item models ................. yes
  Batch tests ............................ no
Qt PrintSupport:
  CUPS ................................... no
Qt Sql Drivers:
  DB2 (IBM) .............................. no
  InterBase .............................. no
  MySql .................................. no
  OCI (Oracle) ........................... no
  ODBC ................................... no
  PostgreSQL ............................. no
  SQLite ................................. yes
    Using system provided SQLite ......... yes


WARNING: Accessibility disabled. This configuration of Qt is unsupported.

ERROR: The OpenGL functionality tests failed! You might need to modify the OpenGL package search path by setting the OpenGL_DIR CMake variable to the OpenGL library's installation directory.

CMake Error at cmake/QtBuildInformation.cmake:194 (message):
  Check the configuration messages for an error that has occurred.
Call Stack (most recent call first):
  cmake/QtBuildInformation.cmake:24 (qt_configure_print_summary)
  cmake/QtBuildInternals/QtBuildInternalsConfig.cmake:548 (qt_print_feature_summary)
  CMakeLists.txt:198 (qt_build_repo_end)


-- Configuring incomplete, errors occurred!
```
</details>

When enabling OpenGl with `spack install qt-base+opengl` it installs without a problem.


### Information on your system

* **Spack:** 0.21.0.dev0 (09e1258ed42f00ea9bde9857f233eeda5c61a895)
* **Python:** 3.11.4
* **Platform:** linux-fedora37-skylake
* **Concretizer:** clingo

### Additional information

in `packages.yaml` I have
```
packages:
  all:
    target: [x86_64]
    variants: +X
```

### General information

- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [X] I have run `spack maintainers <name-of-the-package>` and **@mentioned** any maintainers
- [X] I have uploaded the build log and environment files
- [X] I have searched the issues of this repo and believe this is not a duplicate


Discussion:
Weird, it looks like the `opengl` variant doesn't actually change any cmake settings: it just disables the inclusion of `gl` as a spack dependency...

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/qt-base/package.py b/var/spack/repos/builtin/packages/qt-base/package.py
--- a/var/spack/repos/builtin/packages/qt-base/package.py
+++ b/var/spack/repos/builtin/packages/qt-base/package.py
@@ -235,6 +235,9 @@ def define_feature(key, variant=None):
         for k in features:
             define("FEATURE_" + k, True)
 
+        if "~opengl" in spec:
+            args.append(self.define("INPUT_opengl", "no"))
+
         # INPUT_* arguments: undefined/no/qt/system
         sys_inputs = ["doubleconversion"]
         if "+sql" in spec:


Test patch: