Skip to content

Fix GLSLANG_ENABLE_INSTALL when SHADERC_SKIP_INSTALL is ON - #1592

Open
rootkiller6788 wants to merge 1 commit into
google:mainfrom
rootkiller6788:fix-shaderc-skip-install
Open

rootkiller6788 wants to merge 1 commit into
google:mainfrom
rootkiller6788:fix-shaderc-skip-install

Conversation

@rootkiller6788

Copy link
Copy Markdown

Problem

Running cmake with SHADERC_SKIP_INSTALL=ON fails during generation:

CMake Error in third_party/glslang/CMakeLists.txt:
  install(EXPORT "glslang-targets" ...) includes target "SPIRV" which
  requires target "SPIRV-Tools-opt" that is not in any export set.

Root cause

third_party/CMakeLists.txt sets

set(GLSLANG_ENABLE_INSTALL $<NOT:${SKIP_GLSLANG_INSTALL}>)

Generator expressions are not evaluated at configure time. When SHADERC_SKIP_INSTALL is ON, the variable holds the literal string $<NOT:ON>, which CMake's if() treats as truthy, so glslang still enables its install rules. Since SPIRV-Tools' install is skipped in that configuration, glslang's install(EXPORT glslang-targets) references targets (SPIRV, glslang) whose dependency SPIRV-Tools-opt is not in any export set, and generation fails.

Fix

Compute the boolean directly instead of relying on a generator expression:

if (SKIP_GLSLANG_INSTALL)
  set(GLSLANG_ENABLE_INSTALL OFF)
else()
  set(GLSLANG_ENABLE_INSTALL ON)
endif()

Verification

  • cmake -DSHADERC_SKIP_INSTALL=ON ... previously failed with the error above; with the fix it configures successfully and glslang's cmake_install.cmake contains no install rules.
  • The default configuration (without SHADERC_SKIP_INSTALL) still configures successfully and glslang's install rules are unchanged.

Fixes #1435

The generator expression set(GLSLANG_ENABLE_INSTALL $<NOT:${SKIP_GLSLANG_INSTALL}>)
is not evaluated at configure time.  When SHADERC_SKIP_INSTALL is ON the
variable holds the literal string "$<NOT:ON>", which is truthy, so glslang
still installs its targets.  Since SPIRV-Tools' install is skipped in that
case, glslang's install(EXPORT) fails to generate with:

  install(EXPORT "glslang-targets" ...) includes target "SPIRV" which
  requires target "SPIRV-Tools-opt" that is not in any export set.

Compute the boolean directly from SKIP_GLSLANG_INSTALL instead.

Fixes google#1435
@rootkiller6788
rootkiller6788 marked this pull request as ready for review August 29, 2026 13:24
@YGXXD

YGXXD commented Sep 2, 2026

Copy link
Copy Markdown

I encountered the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SHADERC_SKIP_INSTALL cmake option broken

2 participants