Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: Skip CMAKE_C_COMPILER flags on Windows to avoid conflict with Cl…
…angCL toolset

In setup_env.py, the compile() function was passing -DCMAKE_C_COMPILER=clang
and -DCMAKE_CXX_COMPILER=clang++ universally. When building on Windows
using the -T ClangCL toolset flag, explicitly setting the compiler path
confuses CMake and MSBuild, causing configuration to fail.

This fix checks for Windows platform and skips the compiler flags when
building on Windows, since ClangCL toolset handles compiler selection.
  • Loading branch information
Jah-yee committed Mar 18, 2026
commit 3f7009396b6a09e4c4d905cbce19ecb43224de45
6 changes: 5 additions & 1 deletion setup_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,11 @@ def compile():
logging.error(f"Arch {arch} is not supported yet")
exit(0)
logging.info("Compiling the code using CMake.")
run_command(["cmake", "-B", "build", *COMPILER_EXTRA_ARGS[arch], *OS_EXTRA_ARGS.get(platform.system(), []), "-DCMAKE_C_COMPILER=clang", "-DCMAKE_CXX_COMPILER=clang++"], log_step="generate_build_files")
# On Windows with ClangCL toolset, don't set compiler flags as they conflict
if platform.system() == "Windows":
run_command(["cmake", "-B", "build", *COMPILER_EXTRA_ARGS[arch], *OS_EXTRA_ARGS.get(platform.system(), [])], log_step="generate_build_files")
else:
run_command(["cmake", "-B", "build", *COMPILER_EXTRA_ARGS[arch], *OS_EXTRA_ARGS.get(platform.system(), []), "-DCMAKE_C_COMPILER=clang", "-DCMAKE_CXX_COMPILER=clang++"], log_step="generate_build_files")
# run_command(["cmake", "--build", "build", "--target", "llama-cli", "--config", "Release"])
run_command(["cmake", "--build", "build", "--config", "Release"], log_step="compile")

Expand Down