IMPORTED executable+CMAKE_CROSSCOMPILING_EMULATOR add_custom_command Makefile rule error
hello,
I'm using cmake 3.7.2 on linux64.
When a add_custom_command involves an imported executable and CMAKE_CROSSCOMPILING_EMULATOR is set, the generated Makefile's command appends erroneously the imported target name:
For exmaple consider the following rule with fooConfigureMain the imported executable (defined as /usr/bin/python):
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/main.cxx
DEPENDS main.cxx.in fooConfigureMain
COMMAND fooConfigureMain
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/configure.py ${CMAKE_CURRENT_SOURCE_DIR}/main.cxx.in ${CMAKE_CURRENT_BINARY_DIR}/main.cxx
)
If CMAKE_CROSSCOMPILING_EMULATOR is set:
[ 33%] Generating main.cxx
/usr/bin/python fooConfigureMain /tmp/build/cmake-imported-cross/build/cmake-imported-cross/configure.py /tmp/build/cmake-imported-cross/build/cmake-imported-cross/main.cxx.in /tmp/build/cmake-imported-cross/build/cmake-imported-cross/build/main.cxx
If I either unset CMAKE_CROSSCOMPILING_EMULATOR or do not use the imported executable in the rule the error goes away.
I encountered this bug while cross-compiling VTK, and paraview (withe VTKCompileTools_DIR, and the targets vtkEncodeString, but happens also for qt mocs)
Here's the complete example: https://github.com/jschueller/cmake-imported-cross