Skip to content

Commit 37ca385

Browse files
committed
Show vcpkg version when configuring
1 parent 8ae029d commit 37ca385

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

cmake/cmkr.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ set(CMKR_DIRECTORY "${CMKR_DIRECTORY_PREFIX}${CMKR_TAG}")
6969
set(CMKR_CACHED_EXECUTABLE "${CMKR_DIRECTORY}/bin/${CMKR_EXECUTABLE_NAME}")
7070

7171
# Handle upgrading logic
72-
if(CMKR_EXECUTABLE AND NOT CMKR_CACHED_EXECUTABLE STREQUAL CMKR_EXECUTABLE)
72+
if(CMKR_EXECUTABLE AND NOT CMKR_CACHED_EXECUTABLE STREQUAL CMKR_EXECUTABLE)
7373
if(CMKR_EXECUTABLE MATCHES "^${CMAKE_CURRENT_BINARY_DIR}/_cmkr")
7474
if(DEFINED ENV{CMKR_CACHE} AND EXISTS "$ENV{CMKR_CACHE}")
7575
message(AUTHOR_WARNING "[cmkr] Switching to cached cmkr: '${CMKR_CACHED_EXECUTABLE}'")
@@ -98,7 +98,7 @@ elseif(NOT CMKR_EXECUTABLE AND EXISTS "${CMKR_CACHED_EXECUTABLE}")
9898
else()
9999
set(CMKR_EXECUTABLE "${CMKR_CACHED_EXECUTABLE}" CACHE FILEPATH "Full path to cmkr executable" FORCE)
100100
message(VERBOSE "[cmkr] Bootstrapping '${CMKR_EXECUTABLE}'")
101-
101+
102102
message(STATUS "[cmkr] Fetching cmkr...")
103103
if(EXISTS "${CMKR_DIRECTORY}")
104104
cmkr_exec("${CMAKE_COMMAND}" -E rm -rf "${CMKR_DIRECTORY}")
@@ -202,18 +202,18 @@ macro(cmkr)
202202
# Copy the now-generated CMakeLists.txt to CMakerLists.txt
203203
# This is done because you cannot include() a file you are currently in
204204
configure_file(CMakeLists.txt "${CMKR_TEMP_FILE}" COPYONLY)
205-
205+
206206
# Add the macro required for the hack at the start of the cmkr macro
207207
set_source_files_properties("${CMKR_TEMP_FILE}" PROPERTIES
208208
CMKR_CURRENT_LIST_FILE "${CMAKE_CURRENT_LIST_FILE}"
209209
)
210-
210+
211211
# 'Execute' the newly-generated CMakeLists.txt
212212
include("${CMKR_TEMP_FILE}")
213-
213+
214214
# Delete the generated file
215215
file(REMOVE "${CMKR_TEMP_FILE}")
216-
216+
217217
# Do not execute the rest of the original CMakeLists.txt
218218
return()
219219
endif()

src/cmake_generator.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,11 +604,13 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
604604
if (!project.vcpkg.packages.empty()) {
605605
// Allow the user to specify a url or derive it from the version
606606
auto url = project.vcpkg.url;
607+
auto version_name = url;
607608
if (url.empty()) {
608609
if (project.vcpkg.version.empty()) {
609610
throw std::runtime_error("You need either [vcpkg].version or [vcpkg].url");
610611
}
611612
url = "https://github.com/microsoft/vcpkg/archive/refs/tags/" + project.vcpkg.version + ".tar.gz";
613+
version_name = project.vcpkg.version;
612614
}
613615

614616
// Show a nicer error than vcpkg when specifying an invalid package name
@@ -622,7 +624,7 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
622624
// clang-format off
623625
cmd("if")("CMKR_ROOT_PROJECT", "AND", "NOT", "CMKR_DISABLE_VCPKG");
624626
cmd("include")("FetchContent");
625-
cmd("message")("STATUS", "Fetching vcpkg...");
627+
cmd("message")("STATUS", "Fetching vcpkg (" + version_name + ")...");
626628
cmd("FetchContent_Declare")("vcpkg", "URL", url);
627629
cmd("FetchContent_MakeAvailable")("vcpkg");
628630
cmd("include")("${vcpkg_SOURCE_DIR}/scripts/buildsystems/vcpkg.cmake");

0 commit comments

Comments
 (0)