Skip to content

Commit 89e68cf

Browse files
Merge pull request OpenCyphal-Garage#96 from guludo/fix-windows-build
Fix build on Windows
2 parents 919a794 + 1e04e6b commit 89e68cf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

libuavcan/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ endif ()
2121

2222
project(libuavcan)
2323

24+
find_program(PYTHON python)
25+
2426
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
2527
set(COMPILER_IS_GCC_COMPATIBLE 1)
2628
else ()
@@ -31,7 +33,7 @@ endif ()
3133
# DSDL compiler invocation
3234
# Probably output files should be saved into CMake output dir?
3335
#
34-
execute_process(COMMAND ./setup.py build WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/dsdl_compiler OUTPUT_QUIET)
36+
execute_process(COMMAND ${PYTHON} setup.py build WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/dsdl_compiler OUTPUT_QUIET)
3537
set(DSDLC_INPUTS "test/dsdl_test/root_ns_a" "test/dsdl_test/root_ns_b" "${CMAKE_CURRENT_SOURCE_DIR}/../dsdl/uavcan")
3638
set(DSDLC_OUTPUT "include/dsdlc_generated")
3739

@@ -41,7 +43,7 @@ foreach(DSDLC_INPUT ${DSDLC_INPUTS})
4143
set(DSDLC_INPUT_FILES ${DSDLC_INPUT_FILES} ${DSDLC_NEW_INPUT_FILES})
4244
endforeach(DSDLC_INPUT)
4345
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/libuavcan_dsdlc_run.stamp
44-
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/dsdl_compiler/libuavcan_dsdlc ${DSDLC_INPUTS} -O${DSDLC_OUTPUT}
46+
COMMAND ${PYTHON} ${CMAKE_CURRENT_SOURCE_DIR}/dsdl_compiler/libuavcan_dsdlc ${DSDLC_INPUTS} -O${DSDLC_OUTPUT}
4547
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/libuavcan_dsdlc_run.stamp
4648
DEPENDS ${DSDLC_INPUT_FILES}
4749
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
@@ -79,7 +81,7 @@ add_dependencies(uavcan libuavcan_dsdlc)
7981
install(TARGETS uavcan DESTINATION lib)
8082
install(DIRECTORY include/uavcan DESTINATION include)
8183
install(DIRECTORY include/dsdlc_generated/uavcan DESTINATION include) # Generated and lib's .hpp
82-
install(CODE "execute_process(COMMAND ./setup.py install --record installed_files.log
84+
install(CODE "execute_process(COMMAND ${PYTHON} setup.py install --record installed_files.log
8385
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/dsdl_compiler)")
8486

8587
#

0 commit comments

Comments
 (0)