cmake execute_process command

asked 2017-10-30 09:41:32 -0500

robo_ninja gravatar image

I have created a /csv and /scripts directories in my /src directory. The /csv directory contains a csv file and /scripts directory contains a Python script to parse the csv file. Now I want to use CMake's execute_process to execute this parsing process. I am passing the path to the Python script and csv file as 2 args. Following is how my CMakelists.txt look -

cmake_minimum_required(VERSION 2.8.3)
project(<package_name>)
find_package(catkin REQUIRED)
add_definitions(-std=c++11)
catkin_package(
  INCLUDE_DIRS include
)

set(HON_SCRIPT "${PROJECT_SOURCE_DIR}/scripts/testparser.py")
set(HON_CSV "${PROJECT_SOURCE_DIR}/csv/alarms.csv")

execute_process(
  COMMAND ${HON_SCRIPT} ${HON_CSV}
  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)

Is this the best way to do this? I am not sure if I have use COMMAND correctly.

edit retag flag offensive close merge delete