title: Running a python script at build time in CMake, requires no dependencies
body: <p>I have a python script h2py.py that converts a header file .hpp to .py file.</p>
  <p>I want this python script to be run every time I build my project with CMake.
  There is no other project or file that has a dependency on the file generated by the script.</p>
  <p>So far I have tried this:</p>
  <pre><code>find_package(PythonInterp REQUIRED)
  
  add_custom_target(
   run ALL
   COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/include/converter/h2py.py ${CMAKE_CURRENT_SOURCE_DIR}/include/converter/
   COMMENT &quot;Converting .hpp file to .py file&quot;
  )
  
  add_dependencies(converter run)
  </code></pre>
  <p>But this does not generate the .py equivalent of the .hpp file (specified within the script)</p>
  <p><em>EDIT</em> : When I run the python script h2py.py in a terminal, it generates the .py eqvivalent of the .hpp file, just as intended. But it does not generate the .py file when I run the CMake file.</p>
  <p>This is the whole CMake file:</p>
  <pre><code>cmake_minimum_required(VERSION 2.8.3)
  project(converter)
  
  set(CMAKE_BUILD_TYPE release)
  add_compile_options(-std=c++11)
  
  ## Find catkin macros and libraries
  ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
  ## is used, also find other catkin packages
  find_package(catkin REQUIRED
      roscpp
      geometry_msgs
      eigen_conversions
      std_msgs
      tf_conversions
      tf
      genmsg
      message_generation
      sensor_msgs
      rospy
      gazebo_msgs
  )
  
  catkin_package(
      #DEPENDS Eigen libpcl-all-dev gnuplot
      CATKIN_DEPENDS roscpp sensor_msgs tf_conversions tf geometry_msgs message_generation
      INCLUDE_DIRS include
      LIBRARIES ${PROJECT_NAME}
      )
  ###########
  ## Build ##
  ###########
  
  ## Specify additional locations of header fils
  ## Your package locations should be listed before other locations
  include_directories(
   include
   ${catkin_INCLUDE_DIRS}
  )
  
  ## Declare a C++ library
   add_library(${PROJECT_NAME}
     src/${PROJECT_NAME}/motion_covariance.cpp
     src/${PROJECT_NAME}/tf_utils.cpp
   )
  
  target_link_libraries(${PROJECT_NAME}  ${catkin_LIBRARIES}  ${Boost_LIBRARIES}  )
  
  find_package(PythonInterp REQUIRED)
  
  add_custom_target(
   run ALL
   COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/include/converter/h2py.py ${CMAKE_CURRENT_SOURCE_DIR}/include/converter/
   COMMENT &quot;Converting .hpp file to .py file&quot;
  )
  
  add_dependencies(converter run)
  </code></pre>