views:

46

answers:

1

short -- Is it possible to build a external binary/library out of a project with CMake, when the binary/library only has a makefile given?

So you have your own project, a bunch of CMakeLists.txt in your src-tree and this external library with its source-files. Your sources depend on this library and some binaries/libraries want to link against it. How would one compile this external library if it has only a makefile or Visual Studio project file and no given CMakeLists.txt? Is there a chance to call configure/make out of CMake? Or run an batch-compile with VS under Windows? Or anything else?

Thanks for your help with this one...

+4  A: 

It sounds like you want CMake's external project. I have worked with it quite extensively when developing the Titan build system, and it provides a way of managing multiple out of source builds. You can include ExternalProject, and then something like the following would build the project:

ExternalProject_Add(Qt
   DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}
   URL ${qt_file}
   UPDATE_COMMAND ""
   SOURCE_DIR ${qt_source}
   BUILD_IN_SOURCE 1
   CONFIGURE_COMMAND ${qt_configure}
   BUILD_COMMAND ${qt_build}
   INSTALL_COMMAND "${qt_install}"
   )

There is an article about external projects in the October 2009 issue of the source too. Using external project you can call any make commands available on the host system, we build Qt using their supplied configure command on Windows, Mac and Linux.

Marcus D. Hanwell
Thanks that brought me to the right thing ;)
CipherCom
I am glad it helped. There are several open source projects using this (such as Titan) that you could look at for examples.
Marcus D. Hanwell