-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ensure submodules are initialized when building with cmake #6322
Conversation
@jameslamb do you support this? I'm not sure if we could do this LightGBM/build-cran-package.sh Lines 140 to 156 in b27d81e
with FetchContent. |
I'm -1 on this. Things I'm concerned about:
These are totally solvable problems, but I don't think they're worth the effort just for the benefit "build works without you needing to init What do you think about creating a script in function(assert_submodules_initialized)
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/external_libs/fmt")
message(
FATAL_ERROR
"Missing required source directory: 'external_libs/fmt'. Run 'git submodule update --init --recursive' from the root of the repo and re-run cmake"
)
endif()
# ... and then another for each of the other submodules ...
endfunction() And then sourcing it and calling that function early in assert_submodules_initialized() I think that'd generate a clearer configure-time error than "fast_double_parser.h: no such file or directory", hopefully clear enough to allow people to fix their builds without opening issues here. |
I'm +1 on clearer configure-time error with check functions. |
Checks if the submodules are empty when running cmake (by checking if CMakeLists.txt doesn't exist in their directories) and produces an informative error message if they are.