# Cross toolchain configuration for using clang-cl. set(WINSDK_VER "10.0.19041.0") set(QT5_VERSION "5.12.20") if(WIN32) set(CMAKE_C_COMPILER "C:/llvm/bin/clang-cl.exe") set(CMAKE_CXX_COMPILER "C:/llvm/bin/clang-cl.exe") set(CMAKE_LINKER "C:/llvm/bin/lld-link.exe") set(CMAKE_PREFIX_PATH "C:/Qt/Qt${QT5_VERSION}/${QT5_VERSION}/msvc2017_64/lib/cmake/Qt5") set(QT_INSTALL_PATH "C:/Qt/Qt${QT5_VERSION}/${QT5_VERSION}/msvc2017_64") set(MSVC_BASE "C:/MSVCBuildTools/MSVC") set(WINSDK_BASE "C:/MSVCBuildTools/Kit") else() set(CMAKE_C_COMPILER "/usr/bin/clang-cl-10") set(CMAKE_CXX_COMPILER "/usr/bin/clang-cl-10") set(CMAKE_LINKER "/usr/bin/lld-link-10") set(Qt5_DIR "${PROJECT_SOURCE_DIR}/qt5_msvc2017_64/lib/cmake/Qt5") set(QT_INSTALL_PATH "${PROJECT_SOURCE_DIR}/qt5_msvc2017_64") set(MSVC_BASE "${PROJECT_SOURCE_DIR}/msvc_build_tools/MSVC") set(WINSDK_BASE "${PROJECT_SOURCE_DIR}/msvc_build_tools/Kit") endif() set(CMAKE_SYSTEM_NAME Windows) set(CMAKE_SYSTEM_VERSION 10.0) set(CMAKE_SYSTEM_PROCESSOR AMD64) set(MSVC_INCLUDE "${MSVC_BASE}/include") set(MSVC_LIB "${MSVC_BASE}/lib") 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)