Bug 240553 - [CMake] Should not GLOB
Summary: [CMake] Should not GLOB
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: CMake (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 245440
Blocks:
  Show dependency treegraph
 
Reported: 2022-05-17 17:14 PDT by Michael Catanzaro
Modified: 2022-09-20 12:22 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 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.
Comment 1 Don Olmstead 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.
Comment 2 Michael Catanzaro 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!)