Files @ r25625:c14e95bbb24a
Branch filter:

Location: cpp/openttd-patchpack/source/cmake/FindEditbin.cmake

Patric Stout
Add: '-X' option to ignore global folders in the search path (#9341)

This is extreme useful for automated testing. Without this, OpenTTD
will always look in your personal-dir (like ~/.local/share/openttd
or %USER%\Documents\OpenTTD). For most users this is exactly what
we want, that there is a shared place for all their files.

However, for automated testing this is rather annoying, as your
local development files influence the automated test. As such,
'-X' counters this, and only gives the local folders. This is
especially useful in combination with '-x' and '-c'.
# 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()
        # For clang-cl build
        # find editbin.exe from environmental variable VCToolsInstallDir
        set(EDITBIN_DIRECTORY "$ENV{VCToolsInstallDir}/bin/Hostx64/x64")
    endif()
endif()

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

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

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