dedcb11a4c554696cb0369b87e655cd3dd49628d
[reactos.git] / sdk / cmake / host-tools.cmake
1
2 include(ExternalProject)
3
4 function(setup_host_tools)
5 list(APPEND HOST_TOOLS bin2c widl gendib cabman fatten hpp isohybrid mkhive mkisofs obj2bin spec2def geninc mkshelllink utf16le xml2sdb)
6 if(NOT MSVC)
7 list(APPEND HOST_TOOLS rsym pefixup)
8 endif()
9 list(TRANSFORM HOST_TOOLS PREPEND "${REACTOS_BINARY_DIR}/host-tools/bin/" OUTPUT_VARIABLE HOST_TOOLS_OUTPUT)
10 if (CMAKE_HOST_WIN32)
11 list(TRANSFORM HOST_TOOLS_OUTPUT APPEND ".exe")
12 set(HOST_EXE_SUFFIX ".exe")
13 endif()
14
15 ExternalProject_Add(host-tools
16 SOURCE_DIR ${REACTOS_SOURCE_DIR}
17 PREFIX ${REACTOS_BINARY_DIR}/host-tools
18 INSTALL_DIR ${REACTOS_BINARY_DIR}/host-tools
19 CMAKE_ARGS -UCMAKE_TOOLCHAIN_FILE -DARCH:STRING=${ARCH} -DCMAKE_INSTALL_PREFIX=${REACTOS_BINARY_DIR}/host-tools
20 BUILD_ALWAYS TRUE
21 BUILD_BYPRODUCTS ${HOST_TOOLS_OUTPUT}
22 )
23
24 ExternalProject_Get_Property(host-tools INSTALL_DIR)
25
26 foreach(_tool ${HOST_TOOLS})
27 add_executable(native-${_tool} IMPORTED)
28 set_target_properties(native-${_tool} PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/bin/${_tool}${HOST_EXE_SUFFIX})
29 add_dependencies(native-${_tool} host-tools)
30 endforeach()
31 endfunction()