Repository navigation
cmake: fix verilator_build() version matching and align VERILATOR_ROOT with verilator() - #248
Merged
benoitdenkinger merged 2 commits intoAug 27, 2026
Conversation
added 2 commits
August 27, 2026 13:15
…with verilator() - verilator_build(): cmake_parse_arguments was missing ARGN, so every keyword argument was silently discarded - EXACT_VERSION check now uses STREQUAL/IN_LIST instead of VERSION_EQUAL, which could wrongly consider two different commit hashes equal - fixed a stale cached VERILATOR_ROOT overriding HINTS after a fresh build, causing the version check to fail despite a successful build - verilator(): renamed VERILATOR_HOME to VERILATOR_ROOT and fixed its derivation, aligning it with verilator_build() and Verilator itself
mtravaillard
approved these changes
Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two independent bugs in
verilator_build()that made version checking unreliable, and unifies howVERILATOR_ROOTis derived/consumed acrossverilator_build(),verilator(), and the internalverilator/CMakeLists.txtproject, which previously used inconsistent names and derivations (VERILATOR_HOMEvsVERILATOR_ROOT).Changes
verilator_build.cmakecmake_parse_argumentswas called withoutARGN(bug introduced in fb77394), so every keyword argument passed toverilator_build()(VERILATOR_TAG,INSTALL_DIR,EXACT_VERSION, ...) was silently discarded. Now forwardsARGNagain.EXACT_VERSIONmatching switched fromVERSION_EQUALtoSTREQUAL/IN_LIST:VERSION_EQUALcould wrongly treat two different commit hashes as equal, and doesn't account forverilator-config-version.cmakesometimes keeping a leadingvinPACKAGE_VERSIONand sometimes not, depending on the Verilator release being built. The candidate list now accepts either spelling.VERILATOR_ROOT/verilator_DIRoverridingHINTSafter a fresh build (viaunset(verilator_DIR CACHE)+NO_DEFAULT_PATH), which caused the post-build version check to fail even though the build had succeeded.VERILATOR_TAGis now optional: when omitted, it resolves to themasterbranch HEAD and installs under aheadsubdirectory instead of an empty-named one.verilator.cmakeVERILATOR_HOMEtoVERILATOR_ROOTand fixed its derivation (it was previously derived incorrectly fromverilator_DIR), aligning it withverilator_build()and with the variable name Verilator's own generatedverilator-config.cmakeexpects.verilator/CMakeLists.txtfind_package(verilator)call (HINTS no longer needed now thatVERILATOR_ROOTis exported as an env var beforehand) and clarified in comments whyVERILATOR_ROOTmust be re-exported as an OS environment variable at this configure step specifically (older Verilator versions need it as an env var, and this file'sexecute_process/configure step isn't covered by theenv VERILATOR_ROOT=...wrapping done around the latermakebuild step).