disable warning C5250: _BitScanReverse: intrinsic function not declared
[liba.git] / cmake / UseZig.cmake
blob57c545df31b892fc7b4a756a71d4025cc21f69b4
1 include(${CMAKE_CURRENT_LIST_DIR}/FindZig.cmake)
2 if(ZIG_FOUND)
3   set(CMAKE_CXX_COMPILER ${ZIG_EXECUTABLE} c++)
4   set(CMAKE_C_COMPILER ${ZIG_EXECUTABLE} cc)
5   set(runtime ${CMAKE_CURRENT_BINARY_DIR})
6   include(${CMAKE_CURRENT_LIST_DIR}/TargetSupportsSymbolicLink.cmake)
7   if(NOT TARGET_SUPPORTS_SYMBOLIC_LINK)
8     include(${CMAKE_CURRENT_LIST_DIR}/TemporaryDirectory.cmake)
9     if(EXISTS "${TEMPORARY_DIRECTORY}")
10       string(MD5 runtime "${CMAKE_CURRENT_BINARY_DIR}")
11       set(runtime "${TEMPORARY_DIRECTORY}/${runtime}")
12     endif()
13   endif()
14   if(WIN32)
15     set(CMAKE_AR ${runtime}/ar.bat)
16     file(WRITE ${CMAKE_AR} "@echo off\n\"${ZIG_EXECUTABLE}\" ar %*\n")
17     set(CMAKE_RANLIB ${runtime}/ranlib.bat)
18     file(WRITE ${CMAKE_RANLIB} "@echo off\n\"${ZIG_EXECUTABLE}\" ranlib %*\n")
19     set(CMAKE_DLLTOOL ${runtime}/dlltool.bat)
20     file(WRITE ${CMAKE_DLLTOOL} "@echo off\n\"${ZIG_EXECUTABLE}\" dlltool %*\n")
21   else()
22     set(CMAKE_AR ${runtime}/ar)
23     file(WRITE ${CMAKE_AR} "#!/usr/bin/env sh\nexec \"${ZIG_EXECUTABLE}\" ar \"$@\"\n")
24     execute_process(COMMAND chmod a+rx ${CMAKE_AR})
25     set(CMAKE_RANLIB ${runtime}/ranlib)
26     file(WRITE ${CMAKE_RANLIB} "#!/usr/bin/env sh\nexec \"${ZIG_EXECUTABLE}\" ranlib \"$@\"\n")
27     execute_process(COMMAND chmod a+rx ${CMAKE_RANLIB})
28     set(CMAKE_DLLTOOL ${runtime}/dlltool)
29     file(WRITE ${CMAKE_DLLTOOL} "#!/usr/bin/env sh\nexec \"${ZIG_EXECUTABLE}\" dlltool \"$@\"\n")
30     execute_process(COMMAND chmod a+rx ${CMAKE_DLLTOOL})
31   endif()
32   set(runtime)
33 endif()
34 if(CMAKE_TOOLCHAIN_FILE)
35 endif()