mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
Override the vcpkg/scripts/detect_compiler behavior of always pulling
$CC and $CXX at the time that vcpkg install is determined to need called
by forcing $ENV{CXX} and $ENV{CC} to our CMake-determined compiler.
This prevents strange behavior such as running the following:
./Meta/ladybird.sh run
make changes...
ninja -C Build/ladybird
Where the second build step would be run without CC or CXX set in the
environment, causing a total cache miss from vcpkg and a full rebuild.
It also helps prevent full rebuilds when an IDE passes a slightly
different compiler to the build step than ladybird.sh.
12 lines
530 B
CMake
12 lines
530 B
CMake
# The generated file here is read by vcpkg/base-triplets/base.cmake to ensure consistency between the project
|
|
# build and the vcpkg build.
|
|
set(EXTRA_VCPKG_VARIABLES "")
|
|
if (NOT "${CMAKE_C_COMPILER}" STREQUAL "")
|
|
string(APPEND EXTRA_VCPKG_VARIABLES "set(ENV{CC} ${CMAKE_C_COMPILER})\n")
|
|
endif()
|
|
if (NOT "${CMAKE_CXX_COMPILER}" STREQUAL "")
|
|
string(APPEND EXTRA_VCPKG_VARIABLES "set(ENV{CXX} ${CMAKE_CXX_COMPILER})\n")
|
|
endif()
|
|
|
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/build-vcpkg-variables.cmake" "${EXTRA_VCPKG_VARIABLES}")
|