summaryrefslogtreecommitdiff
path: root/cmake/FindEditbin.cmake
blob: 8ed30599f579334547345809102fca8e97fd8e95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Autodetect editbin. Only useful for MSVC.

if (NOT EDITBIN_DIRECTORY)
    if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
        get_filename_component(MSVC_COMPILE_DIRECTORY ${CMAKE_CXX_COMPILER} DIRECTORY)
        set(EDITBIN_DIRECTORY ${MSVC_COMPILE_DIRECTORY})
    else (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
        # For clang-cl build
        # find editbin.exe from environmental variable VCToolsInstallDir
        set(EDITBIN_DIRECTORY "$ENV{VCToolsInstallDir}/bin/Hostx64/x64")
    endif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
endif (NOT EDITBIN_DIRECTORY)

message(CHECK_START "Finding editbin.exe")
find_program(
    EDITBIN_EXECUTABLE editbin.exe
    HINTS ${EDITBIN_DIRECTORY}
)

if (EDITBIN_EXECUTABLE)
    message(CHECK_PASS "found")
else (EDITBIN_EXECUTABLE)
    message(CHECK_FAIL "not found , please manually specify EDITBIN_DIRECTORY")
endif (EDITBIN_EXECUTABLE)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Editbin
    FOUND_VAR EDITBIN_FOUND
    REQUIRED_VARS EDITBIN_EXECUTABLE
)