Creating directories step fails with ExternalProject_Add

When trying to build and install a library using ExternalProject_Add, I receive the following error:

[ 70%] Creating directories for 'sensor_network'
/bin/sh: 1: /root/cmake-3.25.0-linux-x86_64/bin/cmake;-Dcfgdir=;-P;/root/workspace/multisensor_framework/build/sensor_network-prefix/tmp/sensor_network-mkdirs.cmake: not found
make[2]: *** [CMakeFiles/sensor_network.dir/build.make:118: sensor_network-prefix/src/sensor_network-stamp/sensor_network-mkdir] Error 127
make[1]: *** [CMakeFiles/Makefile2:139: CMakeFiles/sensor_network.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Using the following command in my CMakeLists.txt file:

set(root_path
${CMAKE_CURRENT_BINARY_DIR}/ros2-android-prefix/src/ros2-android-build/deps
${CMAKE_CURRENT_BINARY_DIR}/sensor_network_interfaces)


ExternalProject_Add(sensor_network
  BUILD_ALWAYS ON
  INSTALL_COMMAND cmake -E echo "Skipping install step."
  CMAKE_COMMAND ${cmake_with_env} -DCMAKE_BUILD_TYPE=RELEASE  
  BUILD_COMMAND ${cmake_with_env} --build .
  SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/sensor_network"   
  LIST_SEPARATOR ";" 
  CMAKE_ARGS
  -DCMAKE_FIND_ROOT_PATH=${root_path}
  ${android_cmake_args}
  -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/sensor_network
)

Is this just another case of the same thing in ExternalProject_Add configure permission denied? If so, let’s continue discussion there and avoid creating new threads that are essentially duplicates.

@craig.scott I don’t believe so.

I think I resolved the previous issue by updating the ExternalProject_Add command as shown in this issue, but ran into a different issue here

This looks suspicious. I think you want something more complex here (I use -+- in one of my projects). This is because passing ; around in CMake is problematic.