Created
April 10, 2022 02:38
-
-
Save Qix-/ba48d7e85c2ad63037970aaed2dd6f6a to your computer and use it in GitHub Desktop.
LLVM 15 + MSVC 2021 Community Edition CMake Toolchain file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cross toolchain configuration for using clang-cl. | |
set(CMAKE_SYSTEM_NAME Windows) | |
set(CMAKE_SYSTEM_VERSION 10.0) | |
set(CMAKE_SYSTEM_PROCESSOR AMD64) | |
set(CMAKE_C_COMPILER "/usr/bin/clang-cl-15") | |
set(CMAKE_CXX_COMPILER "/usr/bin/clang-cl-15") | |
set(CMAKE_LINKER "/usr/bin/lld-link-15") | |
set (CMAKE_AR "/usr/bin/llvm-lib-15") | |
set (CMAKE_C_COMPILER_AR "/usr/bin/llvm-lib-15") | |
set (CMAKE_CXX_COMPILER_AR "/usr/bin/llvm-lib-15") | |
set (CMAKE_ASM_COMPILER_AR "/usr/bin/llvm-lib-15") | |
set(MSVC_BASE "/mnt/o/Microsoft\ Visual\ Studio/2022/Community/VC/Tools/MSVC/14.31.31103") | |
set(MSVC_INCLUDE "${MSVC_BASE}/include") | |
set(MSVC_LIB "${MSVC_BASE}/lib") | |
set(WINSDK_BASE "/mnt/c/Program\ Files\ \(x86\)/Windows\ Kits/10") | |
set(WINSDK_VER "10.0.22000.0") | |
set(WINSDK_INCLUDE "${WINSDK_BASE}/Include/${WINSDK_VER}") | |
set(WINSDK_LIB "${WINSDK_BASE}/lib/${WINSDK_VER}") | |
set(COMPILE_FLAGS | |
-D_CRT_SECURE_NO_WARNINGS | |
-imsvc "'${MSVC_INCLUDE}'" | |
-imsvc "'${WINSDK_INCLUDE}/ucrt'" | |
-imsvc "'${WINSDK_INCLUDE}/shared'" | |
-imsvc "'${WINSDK_INCLUDE}/um'" | |
-imsvc "'${WINSDK_INCLUDE}/winrt'" | |
) | |
string(REPLACE ";" " " COMPILE_FLAGS "${COMPILE_FLAGS}") | |
set(_CMAKE_C_FLAGS_INITIAL "${CMAKE_C_FLAGS}" CACHE STRING "") | |
set(CMAKE_C_FLAGS "${_CMAKE_C_FLAGS_INITIAL} ${COMPILE_FLAGS}" CACHE STRING "" FORCE) | |
set(_CMAKE_CXX_FLAGS_INITIAL "${CMAKE_C_FLAGS}" CACHE STRING "") | |
set(CMAKE_CXX_FLAGS "${_CMAKE_CXX_FLAGS_INITIAL} ${COMPILE_FLAGS}" CACHE STRING "" FORCE) | |
set(LINK_FLAGS | |
/manifest:no | |
-libpath:"${MSVC_LIB}/x64" | |
-libpath:"${WINSDK_LIB}/ucrt/x64" | |
-libpath:"${WINSDK_LIB}/um/x64" | |
) | |
string(REPLACE ";" " " LINK_FLAGS "${LINK_FLAGS}") | |
set(_CMAKE_EXE_LINKER_FLAGS_INITIAL "${CMAKE_EXE_LINKER_FLAGS}" CACHE STRING "") | |
set(CMAKE_EXE_LINKER_FLAGS "${_CMAKE_EXE_LINKER_FLAGS_INITIAL} ${LINK_FLAGS}" CACHE STRING "" FORCE) | |
set(_CMAKE_MODULE_LINKER_FLAGS_INITIAL "${CMAKE_MODULE_LINKER_FLAGS}" CACHE STRING "") | |
set(CMAKE_MODULE_LINKER_FLAGS "${_CMAKE_MODULE_LINKER_FLAGS_INITIAL} ${LINK_FLAGS}" CACHE STRING "" FORCE) | |
set(_CMAKE_SHARED_LINKER_FLAGS_INITIAL "${CMAKE_SHARED_LINKER_FLAGS}" CACHE STRING "") | |
set(CMAKE_SHARED_LINKER_FLAGS "${_CMAKE_SHARED_LINKER_FLAGS_INITIAL} ${LINK_FLAGS}" CACHE STRING "" FORCE) | |
set(CMAKE_C_STANDARD_LIBRARIES "" CACHE STRING "" FORCE) | |
set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "" FORCE) | |
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment