Skip to content

Commit f41287b

Browse files
committed
Improve CMake UX: helpful libcurl error, visible fetch progress
Show platform-specific install instructions when libcurl is missing. Switch FetchContent from git clones to tarballs and enable progress output so first-time configure doesn't appear to hang.
1 parent ff65435 commit f41287b

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

CMakeLists.txt

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,26 @@ if(USE_SANITIZERS)
1616
endif()
1717

1818
# Find libcurl
19-
find_package(CURL REQUIRED)
19+
find_package(CURL QUIET)
20+
if(NOT CURL_FOUND)
21+
message(FATAL_ERROR
22+
"libcurl development headers not found.\n"
23+
"Install them with:\n"
24+
" Ubuntu/Debian: sudo apt install libcurl4-openssl-dev\n"
25+
" Fedora/RHEL: sudo dnf install libcurl-devel\n"
26+
" macOS (Homebrew): brew install curl\n"
27+
" macOS (system): usually pre-installed — try: xcode-select --install\n"
28+
)
29+
endif()
2030

21-
# Fetch lightweight JavaScript Object Notation parser
31+
# Fetch dependencies (downloads may take a moment on first configure)
2232
include(FetchContent)
33+
set(FETCHCONTENT_QUIET OFF)
34+
35+
message(STATUS "Fetching nlohmann/json 3.12.0...")
2336
set(JSON_Install OFF CACHE BOOL "" FORCE)
2437
FetchContent_Declare(json
25-
GIT_REPOSITORY https://github.com/nlohmann/json.git
26-
GIT_TAG v3.12.0
38+
URL https://github.com/nlohmann/json/archive/refs/tags/v3.12.0.tar.gz
2739
)
2840
FetchContent_MakeAvailable(json)
2941

@@ -47,10 +59,10 @@ target_link_libraries(how PRIVATE how_core)
4759
option(BUILD_TESTS "Build unit tests" ON)
4860
if(BUILD_TESTS)
4961
enable_testing()
62+
message(STATUS "Fetching googletest 1.17.0...")
5063
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
5164
FetchContent_Declare(googletest
52-
GIT_REPOSITORY https://github.com/google/googletest.git
53-
GIT_TAG v1.17.0
65+
URL https://github.com/google/googletest/archive/refs/tags/v1.17.0.tar.gz
5466
)
5567
FetchContent_MakeAvailable(googletest)
5668

0 commit comments

Comments
 (0)