title: How to get CMake to use existing Makefile?
body: <p>I have an existing project (<code>wvdial</code>) that has a working makefile. I'm trying to integrate it into our main build process which uses CMake.  Can anyone advise on how to do this? I made an attempt below based on some of the other projects we build but the makefile is never called.  All I want to do is call the makefile for wvdial and include the binary in the <code>.deb</code> package we build.</p>
  <pre>
      cmake_minimum_required(VERSION 2.6)
  
      SET(COMPONENT_NAME roots-vendor-wvdial)
  
      SET(DEBIAN_PACKAGE_VERSION 1.6.1)
  
      SET(WVDIAL_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
      SET(WVDIAL_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
      SET(WVDIAL_INSTALLED ${CMAKE_CURRENT_BINARY_DIR})
  
      ADD_CUSTOM_TARGET(
          wvdial ALL
          DEPENDS ${WVDIAL_INSTALLED}
      )
  
      IF (${ROOTS_TARGET_ARCHITECTURE} STREQUAL "armhf")
         SET(TARGET_FLAG "--host=arm-linux-gnueabihf")
      ENDIF()
  
      ADD_CUSTOM_COMMAND(
          WORKING_DIRECTORY ${WVDIAL_BINARY_DIR}
          OUTPUT ${WVDIAL_INSTALLED}
          COMMAND env CXXFLAGS=${ROOTS_COMPILER_FLAGS} ./configure ${TARGET_FLAG} ${ROOTS_HOST_OPTION}
          COMMAND make
          COMMENT "Building wvdial"
          VERBATIM
      )
  
  
      INSTALL(
          FILES ${CMAKE_CURRENT_BINARY_DIR}/wvdial
          DESTINATION usr/local/bin
          COMPONENT ${COMPONENT_NAME}
          PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
      )
  
      DEFINE_DEBIAN_PACKAGE(
          NAME ${COMPONENT_NAME}
          CONTROL_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/debian/control
          CHANGELOG_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/debian/changelog
      )
  </pre>