Albert Z | 1 Mar 2010 02:45
Picon

Re: How to integrate autoconf based library into my cmake build tree

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.calori-qooieK91W7JeoWH0uzbU5w@public.gmane.org> 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
Albert Z | 1 Mar 2010 04:10
Picon

Re: How to integrate autoconf based library into my cmake build tree

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)

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
   )

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?

On Sun, Feb 28, 2010 at 5:45 PM, Albert Z <amzproject-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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.calori-qooieK91W7JeoWH0uzbU5w@public.gmane.org> 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
Michael Wild | 1 Mar 2010 06:48
Picon
Gravatar

Re: How to integrate autoconf based library into my cmake build tree

include(ExternalProject)

Michael

On 1. Mar, 2010, at 2:45 , Albert Z 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.calori@...> 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

Michael Wild | 1 Mar 2010 07:02
Picon
Gravatar

Re: How to integrate autoconf based library into my cmake build tree


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.

> 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.

> 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.

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 <amzproject@...> 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.calori@...> 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

Surya Kiran Gullapalli | 1 Mar 2010 08:54
Picon

add_custom_command issue

Hello all,

I'm struggling with add_custom_command. Let me explain the problem in detail.

I've these set of cxx files and hxx files. I run a perl script on each of them to generate a certain kind of translation file. The command looks like 

perl trans.pl source.cxx -o source_cxx_tro

and similarly for header.hxx files as well.

So I'll end up with some multiple commands (each for a file)

Then I run another perl scripn on the output generated from these commands (source_cxx_tro, header_hxx_tro)

perl combine.pl source_cxx_tro header_hxx_tro -o dir.trx

dir.trx is the output file. 

I've something like this.

Loop_Over_All_Files()
Add_Custom_Command (OUTPUT ${trofile} COMMAND perl trans.pl ${file} -o ${file_tro})
List (APPEND trofiles ${file_tro})
End_Loop()

Add_Custom_Command (TARGET LibraryTarget POST_BUILD COMMAND perl combine.pl ${trofiles} -o LibraryTarget.trx)

What I expect is when building the post build target, the trofiles will be built first. but it is not the case. The ${trofiles} are not getting built and hence the post build command ends in a failure.
Is there any way I can tell the POST_BUILD command depend on the previous custom command ?

Any suggestions ?

Thanks in advance,
Surya
_______________________________________________
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
Michael Wild | 1 Mar 2010 09:00
Picon
Gravatar

Re: add_custom_command issue


On 1. Mar, 2010, at 8:54 , Surya Kiran Gullapalli wrote:

> Hello all,
> I'm struggling with add_custom_command. Let me explain the problem in
> detail.
> 
> I've these set of cxx files and hxx files. I run a perl script on each of
> them to generate a certain kind of translation file. The command looks like
> 
> *perl trans.pl source.cxx -o source_cxx_tro*
> *
> *
> and similarly for header.hxx files as well.
> 
> So I'll end up with some multiple commands (each for a file)
> 
> Then I run another perl scripn on the output generated from these commands
> (source_cxx_tro, header_hxx_tro)
> 
> *perl combine.pl source_cxx_tro header_hxx_tro -o dir.trx*
> *
> *
> *dir.trx* is the output file.
> 
> I've something like this.
> 
> *Loop_Over_All_Files()*
> *Add_Custom_Command (OUTPUT ${trofile} COMMAND perl trans.pl ${file} -o
> ${file_tro})*
> *List (APPEND trofiles ${file_tro})*
> *End_Loop()*
> 
> *Add_Custom_Command (TARGET LibraryTarget POST_BUILD COMMAND perl
> combine.pl${trofiles} -o LibraryTarget.trx)
> *
> 
> What I expect is when building the post build target, the trofiles will be
> built first. but it is not the case. The ${trofiles} are not getting built
> and hence the post build command ends in a failure.
> Is there any way I can tell the POST_BUILD command depend on the previous
> custom command ?
> 
> Any suggestions ?
> 
> Thanks in advance,
> Surya

add_custom_target(TroFilesTarget DEPENDS ${trofiles})
add_dependencies(LibraryTarget TroFilesTarget)

HTH

Michael
_______________________________________________
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

Markus Duft | 1 Mar 2010 09:10
Picon

Re: multicore interix'en testing

Bill Hoffman wrote:
> Markus Duft wrote:
> 
>> Performing coverage
>>  Cannot find any coverage files. Ignoring Coverage request.
>>    Use HTTP Proxy: s01en22.salomon.at:5865
>> Submit files (using http)
>>    Using HTTP submit method
>>    Drop site:http://www.cdash.org/CDash/submit.php?project=CMake
>>    Error when uploading file:
>> /dev/fs/E/buildbot/s01en22vm3-f_base-10.0/build/toolsbase-2010.0/var/tmp/portage/dev-util/cmake-2.8.1_rc3/work/cmake-2.8.1-rc3/Testing/20100226-0844/Build.xml
>>
>>    Error message was: couldn't connect to host
>>    Problems when submitting via HTTP
>> Errors while running CTest
>>
>> i'm using a cntlm proxy, anyone else doing this? :) i can also try to
>> switch back to ntlmaps if that would help some, but i don't think so.
>>
> 
> Can you use the command line curl from this machine?

seems so, yes. what can i do? can i simulate a connection to the
dashboard somehow?

Markus

> 
> -Bill

_______________________________________________
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

Luigi Calori | 1 Mar 2010 09:35
Picon
Favicon

Re: How to integrate autoconf based library into my cmake build tree

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 <amzproject@...> 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.calori@...> 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

Michael Wild | 1 Mar 2010 10:10
Picon
Gravatar

Re: add_custom_command issue


On 1. Mar, 2010, at 9:25 , Surya Kiran Gullapalli wrote:

>> 
>> add_custom_target(TroFilesTarget DEPENDS ${trofiles})
>> add_dependencies(LibraryTarget TroFilesTarget)
>> 
>> 
> Thanks,
> that worked. the problem now is this.
> 
> The individual .tro files which are created are dependent on the file from
> which it is created. say source_cxx_tro is dependent on source.cxx. Ideally
> source_cxx_tro should be generated only when source.cxx is changed (or
> touched).
> 
> But the source_cxx_tro is generated when ever I run the build. Can we avoid
> this ?
> 
> Thanks,
> Surya

you have to tell add_custom_command on what the output depends:

add_custom_command (OUTPUT ${trofile}
  COMMAND perl trans.pl ${file} -o ${file_tro}
  DEPENDS ${file}
  )

Also, you might consider to add trans.pl to the dependency list, since if that one changes, the files should
also be regenerated. Further, relying on perl to be present and being named like this isn't a good idea, you
should use find_package(Perl REQUIRED) instead, and then use ${PERL_EXECUTABLE} in place of just the
plain "perl" command.

HTH

Michael

PS: Please always include the cmake-list in your answer so that others can profit from the discussion...
_______________________________________________
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

Surya Kiran Gullapalli | 1 Mar 2010 10:38
Picon

Re: add_custom_command issue

you have to tell add_custom_command on what the output depends:

add_custom_command (OUTPUT ${trofile}
 COMMAND perl trans.pl ${file} -o ${file_tro}
 DEPENDS ${file}
 )

I'm sorry. I should have been more clearer. I've already done this. But what I'm getting is the .tro files are generated even when the corresponding source file doesn't change.

I have some thing like this.

ForEach (file ${AllFiles})
List(APPEND trofiles ${TransOutFile})
 Add_Custom_Command (
      OUTPUT ${TransOutFile}
      COMMAND ${PERL_EXECUTABLE} ${CUE_MAKE_DIR}/trcomp.pl ${infileModified} -o ${TransOutFile} # this create .tro file from .cxx/.hxx file
      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
      DEPENDS ${file}
      VERBATIM
      )
End_Loop 

  Add_Custom_Command (
    OUTPUT ${trxfile}
    COMMAND ${PERL_EXECUTABLE} ${CUE_MAKE_DIR}/trlink.pl -o ${trxfile} ${trofiles} // this combines all the .tro files to .trx file.
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    COMMENT "Creating translation files for ${LibName} module"
    DEPENDS ${trofiles}
    VERBATIM
    )

Add_Custom_Target (${TargetName}TrxFile DEPENDS ${trxfile}) # Create custom target to create .trx file from .tro files.

Add_Dependencies (${TargetName} ${TargetName}TrxFile) # the library is now dependent on the previous custom target.


So when i build the library, these tro files gets generated and subsequently this .trx file. 

I build it again (without modifying any source files)
The library itself does not get built, but this library depends upon trx file which in turn depend upon .tro files which in turn depends upon the source files. The source files are not changed and hence i expect the tro files does not get generated. But they are getting generated.

Am I missing something here ?

Thanks,
Surya
_______________________________________________
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

Gmane