40c4eb17352859ab1c029e9e280893b667bd896a
[reactos.git] / sdk / cmake / host-tools.cmake
1
2 if(CMAKE_HOST_WIN32)
3 set(native_suffix ".exe")
4 endif()
5
6 string(TOUPPER ${CMAKE_BUILD_TYPE} _build_type)
7
8 # List of host tools
9 list(APPEND host_tools_list bin2c hpp widl gendib cabman fatten isohybrid mkhive mkisofs obj2bin spec2def geninc mkshelllink utf16le xml2sdb)
10 if(NOT MSVC)
11 list(APPEND host_tools_list rsym)
12 endif()
13
14 foreach(_host_tool ${host_tools_list})
15 if(MSVC_IDE)
16 get_filename_component(_tool_location "${CMAKE_CURRENT_BINARY_DIR}/host-tools/${CMAKE_BUILD_TYPE}/${_host_tool}${native_suffix}" ABSOLUTE)
17 else()
18 get_filename_component(_tool_location "${CMAKE_CURRENT_BINARY_DIR}/host-tools/${_host_tool}${native_suffix}" ABSOLUTE)
19 endif()
20 list(APPEND tools_binaries ${_tool_location})
21 add_executable(native-${_host_tool} IMPORTED)
22 set_property(TARGET native-${_host_tool} PROPERTY IMPORTED_LOCATION_${_build_type} ${_tool_location})
23 add_dependencies(native-${_host_tool} host-tools)
24 endforeach()
25
26 include(ExternalProject)
27
28 ExternalProject_Add(host-tools
29 SOURCE_DIR ${REACTOS_SOURCE_DIR}
30 BINARY_DIR ${REACTOS_BINARY_DIR}/host-tools
31 STAMP_DIR ${REACTOS_BINARY_DIR}/host-tools/stamps
32 BUILD_ALWAYS 1
33 PREFIX host-tools
34 EXCLUDE_FROM_ALL 1
35 CMAKE_ARGS "-DNEW_STYLE_BUILD=1;-DARCH:STRING=${ARCH}"
36 INSTALL_COMMAND ""
37 BUILD_BYPRODUCTS ${tools_binaries})