37

I have an existing project (wvdial) 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 .deb package we build.

 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 ) 

1 Answer 1

35

Take a look at the ExternalProject module.

This will add a dummy target to your CMake project that is responsible for building the dependency. The command is quite complex and supports a lot of stuff that you probably won't need in your case. Kitware (the company behind CMake) did a nice post called Building External Projects with CMake 2.8 a while back explaining the basic use of that command.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.