Bug 240553

Summary: [CMake] Should not GLOB
Product: WebKit Reporter: Michael Catanzaro <mcatanzaro>
Component: CMakeAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: bugs-noreply, don.olmstead, mcatanzaro
Priority: P2    
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Bug Depends on: 245440    
Bug Blocks:    

Michael Catanzaro
Reported 2022-05-17 17:14:10 PDT
The CMake documentation explicitly warns against using GLOB at https://cmake.org/cmake/help/latest/command/file.html#filesystem, but we do it anyway in these places: Source/JavaScriptCore/CMakeLists.txt:file(GLOB JavaScriptCore_SCRIPTS_SOURCES ${JavaScriptCore_SCRIPTS_SOURCES_PATHS}) Source/ThirdParty/capstone/Source/CMakeLists.txt:FILE(GLOB CSTOOL_SRC cstool/*.c) Source/ThirdParty/libwebrtc/Source/third_party/boringssl/src/CMakeLists.txt: file(GLOB LIBCXX_SOURCES "util/bot/libcxx/src/*.cpp") Source/ThirdParty/libwebrtc/Source/third_party/boringssl/src/CMakeLists.txt: file(GLOB LIBCXXABI_SOURCES "util/bot/libcxxabi/src/*.cpp") Source/ThirdParty/libwebrtc/Source/third_party/boringssl/src/CMakeLists.txt: file(GLOB LIBFUZZER_SOURCES "util/bot/libFuzzer/*.cpp") Source/ThirdParty/libwebrtc/Source/third_party/yasm/cmake/modules/CMakeLists.txt:FILE(GLOB cmakeFiles "${CMAKE_CURRENT_SOURCE_DIR}/*.cmake") Source/WebCore/platform/gtk/po/CMakeLists.txt:file(GLOB po_files *.po) Source/WebInspectorUI/CMakeLists.txt:file(GLOB InspectorFilesDependencies Source/cmake/FindGI.cmake: file(GLOB src_files LIST_DIRECTORIES FALSE CONFIGURE_DEPENDS "${src}/*.c" "${src}/*.cpp") Source/cmake/WebKitMacros.cmake: file(GLOB files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${dir}/*.h) If somebody is sufficiently bored, fixing these would be good to do. If there are cases that are difficult to fix, we should at least use CONFIGURE_DEPENDS. It's unlikely that it's ever appropriate to use GLOB without CONFIGURE_DEPENDS.
Attachments
Don Olmstead
Comment 1 2022-09-20 11:37:38 PDT
I agree but I think we should leave out anything in Source/ThirdParty unless it was explicitly written by WebKit folks.
Michael Catanzaro
Comment 2 2022-09-20 12:22:31 PDT
(In reply to Don Olmstead from comment #1) > I agree but I think we should leave out anything in Source/ThirdParty unless > it was explicitly written by WebKit folks. Of course, we shouldn't carry downstream changes to third-party CMake files just for this. (Fixing it upstream would be ideal, though!)
Note You need to log in before you can comment on or make changes to this bug.