fix(pdfx): gate DOWNLOAD_EXTRACT_TIMESTAMP on CMake < 3.24 (Windows build)#612
Open
Ahmedmmy97 wants to merge 1 commit into
Open
fix(pdfx): gate DOWNLOAD_EXTRACT_TIMESTAMP on CMake < 3.24 (Windows build)#612Ahmedmmy97 wants to merge 1 commit into
Ahmedmmy97 wants to merge 1 commit into
Conversation
DOWNLOAD_EXTRACT_TIMESTAMP was added to ExternalProject_Add in CMake 3.24. On older CMake (notably 3.20 bundled with Visual Studio 2019 BuildTools), the keyword is unrecognised, so cmake_parse_arguments absorbs it - and its FALSE value - as additional values of the previous multi-value keyword, URL. The validator inside _ep_add_download_command then sees a multi-entry URL list with non-URL entries and bails with "At least one entry of URL is a path (invalid in a list)". The plugin declares cmake_minimum_required(VERSION 3.15) but used a 3.24+ keyword unconditionally. Gate it on CMAKE_VERSION VERSION_LESS "3.24" so the option is only passed where supported. No behaviour change on modern CMake; older CMake skips the option (its only effect is to suppress a 3.24 deprecation warning about extracted-file timestamps). Refs ScerIO#601 (open). Refs flutter/flutter#186062 (closed there as third-party).
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 the Windows build failure reported in #601 (and the duplicate routed via flutter/flutter#186062) for users on CMake < 3.24. The plugin currently passes
DOWNLOAD_EXTRACT_TIMESTAMP FALSEtodownload_projectunconditionally, but thatExternalProject_Addkeyword was only added in CMake 3.24. On older CMake β including 3.20 bundled with Visual Studio 2019 BuildTools β the keyword is unrecognised andcmake_parse_argumentsabsorbs it (and itsFALSEvalue) as additional values of the most recent multi-value keyword,URL. The URL bucket becomes a 3-entry list, the validator inModules/ExternalProject.cmakewalks it, finds entries that don't match^[a-z]+://, and bails with:The plugin declares
cmake_minimum_required(VERSION 3.15)while using a 3.24+ keyword unconditionally β this PR closes that mismatch.Fix
Gate the
DOWNLOAD_EXTRACT_TIMESTAMP FALSEarguments onCMAKE_VERSION VERSION_LESS "3.24". On modern CMake the behaviour is unchanged. On CMake 3.20β3.23 the option is omitted anddownload_projectsucceeds (the only effect of omitting it is a CMake-3.24 deprecation warning about extracted-file timestamps, which is harmless for non-reproducible-build users).Verification
Reproduced and verified in a Docker harness using
ubuntu:24.04+ the officialcmake-3.20.6Linux binary, the unmodifiedwindows/CMakeLists.txtandDownloadProject.cmakefrommain. The bug is purely CMake-argument-parsing β no Windows-specific behaviour is needed to reproduce it.mainExternalProject.cmake:2773 β 3683 β CMakeLists.txt:9)mainThe line numbers in the user-reported stack (2771 / 3681) vs reproduction (2773 / 3683) differ by 2 because of patch-level differences between the VS2019-bundled CMake 3.20.x and the official 3.20.6 release; the call-graph and validator logic are identical.
Scope
packages/pdfx/windows/CMakeLists.txt. No Dart, no other platforms.cmake_minimum_requiredbump β keeps VS2019 BuildTools users supported.download_project(PROJ\n pdfium ...)formatting was tightened to one keyword/value per line, matching the rest of the file.Refs
Caveat on #601
The original #601 reporter is on Visual Studio 2026, which ships CMake β₯ 3.30. On that version
DOWNLOAD_EXTRACT_TIMESTAMPis recognised, so this PR may not address the exact trigger they hit even though their error chain is identical. I haven't been able to reproduce the VS2026 variant. Happy to leave #601 open if the maintainer prefers and re-target this PR at a fresh "build fails on VS2019 / CMake 3.20" issue, or merge as-is and ask the #601 reporter to retest.