[CMAKE] winspool.drv -> winspool in baseaddress_msvc.cmake
[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 if(USE_CLANG_CL)
27 # FIXME: Fix host tools build with clang
28 #set(USE_CLANG_CL_ARG "-DCMAKE_C_COMPILER=clang-cl;-DCMAKE_CXX_COMPILER=clang-cl")
29 endif()
30
31 include(ExternalProject)
32
33 ExternalProject_Add(host-tools
34 SOURCE_DIR ${REACTOS_SOURCE_DIR}
35 BINARY_DIR ${REACTOS_BINARY_DIR}/host-tools
36 STAMP_DIR ${REACTOS_BINARY_DIR}/host-tools/stamps
37 BUILD_ALWAYS 1
38 PREFIX host-tools
39 EXCLUDE_FROM_ALL 1
40 CMAKE_ARGS "-DNEW_STYLE_BUILD=1;-DARCH:STRING=${ARCH};${USE_CLANG_CL_ARG}"
41 INSTALL_COMMAND ""
42 BUILD_BYPRODUCTS ${tools_binaries})