Michael Wild wrote:
On 1. Mar, 2010, at 4:10 , Albert Z wrote:

I just found that unless I explicitly include ExternalProject.cmak in my
cmake build, cmake won't find command "ExternalProject_Add", which is pretty
weird for me.
include(/usr/local/share/cmake-2.8/Modules/ExternalProject.cmake)

Again:

include(ExternalProject)

will do... But then, the man-pages would tell you that.
The

ExternalProject.cmake contains the function ExternalProject_Add ... so you have to explicitly include it to have the function defined.

And now the problem is that if I use the following cmake script to build apr

  ExternalProject_Add(${LIB_NAME}
    PREFIX /home/xxx/prj/trunk/external/apr/1.3.9
    SOURCE_DIR /home/xxx/prj/trunk/external/apr/1.3.9
    CONFIGURE_COMMAND /home/xxx/prj/trunk/external/apr/1.3.9/configure
--enable-static --disable-shared --disable-ipv6
    BINARY_DIR "/home/xxx/prj/trunk/external/apr/1.3.9/.libs/"
    BUILD_COMMAND make all
  )


You most probably don't want to use hard-coded paths, but something relative to 
either CMAKE_SOURCE_DIR or CMAKE_BINARY_DIR.
Correct, otherwise you ' ll have to change your cmake code whan move the
stuff

CMake complains

 error: no download info for 'apr' -- please specify existing SOURCE_DIR or
 one of URL, CVS_REPOSITORY and CVS_MODULE, SVN_REPOSITORY or
 DOWNLOAD_COMMAND

I have already specified the SOURCE_DIR, and I do not want the library is
downloaded online. Is it a bug of CMake? Or I have done something wrong?

Does SOURCE_DIR exist and contain the apr sources?

If I was you, I'd prefer to specify a URL to a tar-ball on the local system 
(e.g. ${CMAKE_SOURCE_DIR}/external/apr-1.3.9.tgz), point SOURCE_DIR to 
${CMAKE_BINARY_DIR}/external/apr and then let CMake to the rest.
If your source is alredy complete, try setting up DOWNLOAD_COMMAND ""
Anyway, I agree it would be probably better specifying a URL (either
local or remote) like
URL http://apache.fastbull.org/apr/apr-1.3.9.tar.gz and let him do: it
is cleaner and easier.

Then if you have mods, you can specify a PATCH_COMMAND to apply your patches
If apr configure must be run in-source, specify

BUILD_IN_SOURCE 1

But in that case, if you do not have a download step, your source will be cluttered, so another good reason
to specify a URL

I' ll probably would add some configure based libs to my deps, If you are interested, I' ll let you know.

Luigi


Also, I might be wrong, but are you building in-source? If so, please don't and 
read http://www.cmake.org/Wiki/CMake_FAQ#Out-of-source_build_trees.

Michael

On Sun, Feb 28, 2010 at 5:45 PM, Albert Z <amzproj...@gmail.com> wrote:

Thanks, Luigi. However, I read the CMake 2.8 doc and tried to use function
"ExternalProject_Add". When I ran cmake in the root of my project, I got the
following error

Unknown CMake command "ExternalProject_Add"

I tried on both linux and mac and got the same error. And I am sure the
version of the cmake is 2.8

Best,
Meng


On Sun, Feb 28, 2010 at 4:50 AM, Luigi Calori <l.cal...@cineca.it> wrote:

Albert Z wrote:

Hello,
Our project now uses a bunch of 3rd party libraries such as apr,
protobuf, libcurl, etc. Almost all of these libraries use autoconf (
configure.in <http://configure.in>) based build system. Since we have
some modifications to most of the libraries, we have to integrate these
libraries to our cmake build tree. What is the easiest way to integrate such
a 3rd-party library to a cmake build with keeping the maximum portability?

Try to look at ExternalProject module
http://www.cmake.org/cmake/help/cmake-2-8-docs.html#module:ExternalProject
and page 10 of
http://www.kitware.com/products/archive/kitware_quarterly1009.pdf

I have used it (with some mods): it allow to automate download
pactch,build and install)
Anyway, curl have recently included a CMakeLists in its distribution. I
have used it even if had to apply some patches.
I am trying to collect some cmake build recipes for some libraries I need.
If you are interested, grab the stuff at
bzr branch http://3d.cineca.it/storage/bazaar_repo/CmakeDeps/lib

HTH

Luigi

------------------------------------------------------------------------
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake





_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to