add_custom_command + imported target + cross-compiling error
when crosscompiling and using an imported target from add_custom_command (or add_custom_target), cmake does not use the target's CROSSCOMPILING_EMULATOR property:
add_executable (fooConfigureMain IMPORTED)
set_target_properties(fooConfigureMain PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/configure.py")
set_target_properties(fooConfigureMain PROPERTIES CROSSCOMPILING_EMULATOR "/usr/bin/python")
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/main.cxx
DEPENDS main.cxx.in fooConfigureMain
COMMAND fooConfigureMain ${CMAKE_CURRENT_SOURCE_DIR}/main.cxx.in ${CMAKE_CURRENT_BINARY_DIR}/main.cxx
)
errors with:
../configure.py /home/schueller/projects/cmake-custom_target-cross/main.cxx.in /home/schueller/projects/cmake-custom_target-cross/build/main.cxx
make[3]: execvp: ../configure.py: Permission denied
I pushed the full testcase here: https://github.com/jschueller/cmake-custom_target-cross
I'm using cmake 3.15.4