CMake: use FIND_PROGRAM

While cross-compiling, it is easier to find a binary
from the patch using FIND_PROGRAM instead of using
a cmake file.

Try to find c4group native tool with FIND_PROGRAM and
fallback to the cmake file if c4group is not found.

Signed-off-by: Romain Naour <romain.naour@gmail.com>
master
Romain Naour 2017-07-21 23:53:28 +02:00 committed by Julius Michaelis
parent 48c38c91dc
commit 87b60e99f6
1 changed files with 9 additions and 3 deletions

View File

@ -1491,9 +1491,15 @@ ENDIF()
# When cross-compiling, import c4group from a native build
IF(CMAKE_CROSSCOMPILING)
SET(IMPORT_NATIVE_TOOLS "IMPORT_NATIVE_TOOLS-NOTFOUND" CACHE FILEPATH "Export file from a native build")
INCLUDE(${IMPORT_NATIVE_TOOLS})
SET(native_c4group native-c4group)
FIND_PROGRAM(C4GROUP_PATH NAMES c4group PATHS)
IF (NOT C4GROUP_PATH)
SET(IMPORT_NATIVE_TOOLS "IMPORT_NATIVE_TOOLS-NOTFOUND" CACHE FILEPATH "Export file from a native build")
INCLUDE(${IMPORT_NATIVE_TOOLS})
SET(native_c4group native-c4group)
ELSE()
SET(native_c4group ${C4GROUP_PATH})
ENDIF()
ELSE()
SET(native_c4group c4group)
ENDIF()