# Windows XP set(CMAKE_SYSTEM_NAME Windows) set(CMAKE_SYSTEM_VERSION 5.1) set(CMAKE_SYSTEM_PROCESSOR x86) set(TARGET_VERSION_MAJOR 5) set(TARGET_VERSION_MINOR) set(_MSVC_TRIPLET "i686-pc-windows-msvc") # CXXRTDIR = $(VCDIR)/crt # UCRTDIR = $(VCDIR)/ucrt # PSDKDIR = $(VCDIR)/winsdk if("$ENV{VCDIR}" STREQUAL "") message(FATAL_ERROR "Please set VCDIR in your environment to an appropiate path.") endif() set(_CRTDIR "$ENV{VCDIR}/crt") set(_UCRTDIR "$ENV{VCDIR}/ucrt") set(_PSDKDIR "$ENV{VCDIR}/winsdk") set(_CLANG_BASEFLAGS "-target ${_MSVC_TRIPLET} -fms-extensions -fms-compatibility-version=19 -isystem ${_CRTDIR}/include -isystem ${_UCRTDIR}/include -isystem ${_PSDKDIR}/include/shared -isystem ${_PSDKDIR}/include/um") set(_CLANG_ARCHFLAGS "-march=pentium4") set(CMAKE_C_COMPILER "clang" CACHE FILEPATH "") set(CMAKE_CXX_COMPILER "clang++" CACHE FILEPATH "") set(CMAKE_LINKER "lld-link" CACHE FILEPATH "") set(CMAKE_ASM_FLAGS_INIT "${_CLANG_BASEFLAGS} ${_CLANG_ARCHFLAGS}") set(CMAKE_C_FLAGS_INIT "${_CLANG_BASEFLAGS} ${_CLANG_ARCHFLAGS}") set(CMAKE_C_FLAGS_RELEASE_INIT "${CMAKE_C_FLAGS_INIT} -fomit-frame-pointer") set(CMAKE_CXX_FLAGS_INIT "${CMAKE_C_FLAGS_INIT}") set(CMAKE_CXX_FLAGS_RELEASE_INIT "${CMAKE_C_FLAGS_RELEASE_INIT} ${CMAKE_CXX_FLAGS_INIT}") # Set base linker library paths foreach(type EXE MODULE SHARED) set(CMAKE_${type}_LINKER_FLAGS "-Xlinker /libpath:${_CRTDIR}/lib/x86 -Xlinker /libpath:${_UCRTDIR}/lib -Xlinker /libpath:${_PSDKDIR}/lib") endforeach() # Remove fluff libraries; projects should specify them set(CMAKE_C_STANDARD_LIBRARIES "" CACHE STRING "" FORCE) set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "" FORCE) # Run this once after you call project() to replace broken macro(xp_init) foreach(lang C CXX) # have to patch the link commands to replace /MANIFEST:EMBED with /MANIFEST:NO # because .... set(CMAKE_${lang}_CREATE_SHARED_LIBRARY " -nostartfiles -nostdlib -o ${CMAKE_GNULD_IMAGE_VERSION} -Xlinker /MANIFEST:EMBED -Xlinker /implib: -Xlinker /pdb: -Xlinker /version:${CMAKE_SYSTEM_VERSION} " CACHE STRING "" FORCE) set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY} CACHE STRING "") set(CMAKE_${lang}_LINK_EXECUTABLE " -nostartfiles -nostdlib -o -Xlinker /MANIFEST:NO -Xlinker /implib: -Xlinker /pdb: -Xlinker /version:${CMAKE_SYSTEM_VERSION} ${CMAKE_GNULD_IMAGE_VERSION} " CACHE STRING "" FORCE) # also patch these so we can set the subsytem version set(CMAKE_${lang}_CREATE_WIN32_EXE "-Xlinker /subsystem:windows,${CMAKE_SYSTEM_VERSION}" CACHE STRING "") set(CMAKE_${lang}_CREATE_CONSOLE_EXE "-Xlinker /subsystem:console,${CMAKE_SYSTEM_VERSION}" CACHE STRING "") endforeach() endmacro()