[CMake] add_custom_command issue

2010-02-28 Thread Surya Kiran Gullapalli
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

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

2010-02-28 Thread Michael Wild

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

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

2010-02-28 Thread Michael Wild
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  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 ) 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


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

2010-02-28 Thread Albert Z
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  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  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 ) 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

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

2010-02-28 Thread Albert Z
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  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 ) 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

Re: [CMake] FindCurses wide

2010-02-28 Thread Gary Briggs
On Sun, Feb 28, 2010 at 06:22:03PM -0500, Philip Lowman wrote:
> If it's not too much trouble, could you please open a ticket for this?
> http://www.cmake.org/Bug

No problem:
http://www.cmake.org/Bug/view.php?id=10347

Thanks,
Gary (-;
___
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


Re: [CMake] FindCurses wide

2010-02-28 Thread Philip Lowman
If it's not too much trouble, could you please open a ticket for this?
http://www.cmake.org/Bug

On Sat, Feb 27, 2010 at 10:53 PM, Gary Briggs  wrote:
> I found this thread from a while ago while searching for how to get
> ncurses to support wide chars:
>
> http://www.mail-archive.com/cmake@cmake.org/msg15578.html
>
> Please find attached a modified version of FindCurses.cmake that looks
> for the wide variants of curses if asked. It's working for me... [this
> is against a 2.6 module. I checked the 2.8 and it looks like some
> boilerplate has been added, but it's otherwise the same].
>
> Thanks,
> Gary (-;
>
> ___
> 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
>



-- 
Philip Lowman
___
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


Re: [CMake] Can CMake prompt the user for input while it's running?

2010-02-28 Thread Naram Qashat

On 02/28/10 11:52, Eric Noulard wrote:

2010/2/28 Bill Hoffman:




Off course the cmake UI would authorize to unfilter all vars
just as today there is the advanced/normal view.


You could just use the advanced/non-advanced to handle this. When you want
to show a variable to the user make it non-advanced.  This would work with
ccmake, cmake -i, and cmake-gui.  They all default to showing non-advanced
variables by default.


As far as I understand Naram needs he wants to show far less variable
shown by cmake today (including vars coming from find_package(whatever))

Not mentionning the fact that mark_as_advanced makes the variable a CACHE
one which is not necesseraly what you want. You may even want to have a CACHED
variable shown to the user.

Basically I think you (Bill) are right the current "advanced" var
should be enough
but I doubt it correspond to Naram needs. I may be wrong, thus let Naram explain
himself :-)


Well, using cmake -i might work for me, but I'm not sure if the format it shows 
the information in would be any less confusing to our users.  It'd be nice if 
CMake didn't have to show the variable name and could just show the description. 
 The people using our program are not the brightest bunch of people around, and 
I wish I was exaggerating this.  Right now we rely on a separate shell script 
(and a CScript file for Windows) to pre-configure in order to get information 
from the users in order to configure through CMake, but as I mentioned in my 
first e-mail, this won't help if we have a variable amount of files that I want 
to ask for prompting from the users on.


Now, a side thought I had, could I create a CMake file that can be run through 
cmake -P in order to determine any options I might need, and pass that as output 
that our pre-configure script can handle from there?  This might be an option if 
I can't handle this through CMake entirely.


Thanks,
Naram Qashat
___
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


Re: [CMake] How to install headers in a library

2010-02-28 Thread Giampiero Gabbiani
In data domenica 28 febbraio 2010 11:50:20, Michael Wild ha scritto:
: > On 28. Feb, 2010, at 11:09 , Hendrik Sattler wrote:
> > Am Sonntag 28 Februar 2010 10:31:57 schrieb Giampiero Gabbiani:
> >> Hi all,
> >> I like very much the simplicity of cmake in comparison with the classic
> >> autotools framework, but still I have two questions concerning the
> >> porting of a Linux based project under cmake:
> >>
> >> 1) when defining a library (shared or static) as a project target , I
> >> expected that cmake would understand the architecture of the host
> >> machine and install conseguently the libraries (.so or .a) in the
> >> correct /lib or /lib64 path. Instead I noticed that I have to explicity
> >> set the destination path
> >>
> >> install(TARGETS  ARCHIVE DESTINATION lib64)
> >> install(TARGETS  LIBRARY DESTINATION lib64)
> >>
> >> This works well on my machine (a 64 bit system) but of course will not
> >> work if anyone want to install on a 32 bit system.
> >>
> >> So ... is there a way in order to let cmake automatically install on the
> >> correct path according with the hosting system architecture?
> >>
> >> 2) together with the resulting binaries libs (both archive and library)
> >> I want to install also the corrisponding header(s) in /usr/local/include
> >> path...how is it possible to do that?
> >
> > You could use a variable to represent the directory. This would depend on
> > the existence of lib64/ (not all have this as directory, on Debian it's
> > just a compatibility link to lib/) and on SIZEOF_VOID_P being 8:
> > set (LIBRARY_INSTALL_DIR lib)
> > if (EXISTS "${CMAKE_INSTALL_PREFIX}/lib32/" AND CMAKE_SIZEOF_VOID_P EQUAL
> > 4) set (LIBRARY_INSTALL_DIR lib32)
> > elif (EXISTS "${CMAKE_INSTALL_PREFIX}/lib64/" AND CMAKE_SIZEOF_VOID_P
> > EQUAL 8) set (LIBRARY_INSTALL_DIR lib64)
> > endif ()
> >
> > Or let the user set it.
> >
> > HS
> 
> Such decisions I often handle like this:
> 
> - compute a sensible default, as Hendrik showed above.
> - use that default to set a cache variable
> - let the user override the default using the cache variables
> 
> In above example this would be:
> 
> # compute default library install dir
> set (_DEFAULT_LIBRARY_INSTALL_DIR lib)
> if (EXISTS "${CMAKE_INSTALL_PREFIX}/lib32/" AND CMAKE_SIZEOF_VOID_P EQUAL
>  4) set (_DEFAULT_LIBRARY_INSTALL_DIR lib32)
> elif (EXISTS "${CMAKE_INSTALL_PREFIX}/lib64/" AND CMAKE_SIZEOF_VOID_P EQUAL
>  8) set (_DEFAULT_LIBRARY_INSTALL_DIR lib64)
> endif ()
> # the library install dir
> set(LIBRARY_INSTALL_DIR "${_DEFAULT_LIBRARY_INSTALL_DIR}" CACHE PATH
>  "Installation directory for libraries") # make the library install dir an
>  absolute path (can be important e.g. when using CONFIGURE_FILE to embed #
>  the library installation directory into a file)
> if(NOT IS_ABSOLUTE "${LIBRARY_INSTALL_DIR}")
>   set(LIBRARY_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIBRARY_INSTALL_DIR}")
> endif()
> 
> 
> Of course, you can extend the logic for the default selection to handle
>  particularities of other platforms, such as Windows.
> 
> HTH
> 
> Michael
> 
Great!
Many thanks!
Giampiero
___
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


Re: [CMake] Can CMake prompt the user for input while it's running?

2010-02-28 Thread Eric Noulard
2010/2/28 Bill Hoffman :
>
>>
>> Off course the cmake UI would authorize to unfilter all vars
>> just as today there is the advanced/normal view.
>
> You could just use the advanced/non-advanced to handle this. When you want
> to show a variable to the user make it non-advanced.  This would work with
> ccmake, cmake -i, and cmake-gui.  They all default to showing non-advanced
> variables by default.

As far as I understand Naram needs he wants to show far less variable
shown by cmake today (including vars coming from find_package(whatever))

Not mentionning the fact that mark_as_advanced makes the variable a CACHE
one which is not necesseraly what you want. You may even want to have a CACHED
variable shown to the user.

Basically I think you (Bill) are right the current "advanced" var
should be enough
but I doubt it correspond to Naram needs. I may be wrong, thus let Naram explain
himself :-)
-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
___
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


Re: [CMake] CMAKE_TOOLCHAIN_FILE support, empty CMAKE_AR && CMAKE_RANLIB

2010-02-28 Thread Alexander Neundorf
On Saturday 27 February 2010, Oleg Kravchenko wrote:
> Hello i am try build tinyxml library by mingw32 on gentoo linux with cmake:
> =dev-util/cmake-2.6.4-r3
> =dev-util/cmake-2.8.0-r2
>
> But have this errors:
> $ cmake -DCMAKE_TOOLCHAIN_FILE=~/i686-pc-mingw32.cmake -
> DDOKAN_INCLUDE_DIR=~/projects/dokan/ -DCMAKE_BUILD_TYPE=Debug .
> -- The C compiler identification is GNU
> -- The CXX compiler identification is GNU
> -- Check for working C compiler: /usr/bin/i686-pc-mingw32-gcc
> -- Check for working C compiler: /usr/bin/i686-pc-mingw32-gcc -- works
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Check for working CXX compiler: /usr/bin/i686-pc-mingw32-g++
> -- Check for working CXX compiler: /usr/bin/i686-pc-mingw32-g++ -- works
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/kaa/projects/tinyxml
> $ make
> [ 12%] Building CXX object
> tinyxml_build/CMakeFiles/tinyxml.dir/tinystr.cpp.obj
> [ 25%] Building CXX object
> tinyxml_build/CMakeFiles/tinyxml.dir/tinyxml.cpp.obj
> [ 37%] Building CXX object
> tinyxml_build/CMakeFiles/tinyxml.dir/tinyxmlerror.cpp.obj
> [ 50%] Building CXX object
> tinyxml_build/CMakeFiles/tinyxml.dir/tinyxmlparser.cpp.obj
> Linking CXX static library
> /home/kaa/projects/sqlfs/target/Debug/libtinyxml.a Error running link
> command: No such file or directory
> make[2]: *** [/home/kaa/projects/win32/target/Debug/libtinyxml.a] Error 2
> make[1]: *** [tinyxml_build/CMakeFiles/tinyxml.dir/all] Error 2
> make: *** [all] Error 2
>
> I "fix" problem by patching CMakeFindBinUtils.cmake
>
> Please fix and release 2.6.x and 2.8.x version

Strange.
Please apply the attached patch to CMakeDetermineCCompiler.cmake and run cmake 
again on a fresh build dir, and post the output.

Alex
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 17fa05f..520144a 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -68,8 +68,11 @@ IF(NOT CMAKE_C_COMPILER)
   IF(CMAKE_C_COMPILER_INIT AND NOT CMAKE_C_COMPILER)
 SET(CMAKE_C_COMPILER "${CMAKE_C_COMPILER_INIT}" CACHE FILEPATH "C compiler" FORCE)
   ENDIF(CMAKE_C_COMPILER_INIT AND NOT CMAKE_C_COMPILER)
+  message(STATUS "Found CMAKE_C_COMPILER: -${CMAKE_C_COMPILER}-")
+
 ELSE(NOT CMAKE_C_COMPILER)
 
+  message(STATUS "CMAKE_C_COMPILER was preset: -${CMAKE_C_COMPILER}-")
   # we only get here if CMAKE_C_COMPILER was specified using -D or a pre-made CMakeCache.txt
   # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
   # if CMAKE_C_COMPILER is a list of length 2, use the first item as 
@@ -94,6 +97,8 @@ ELSE(NOT CMAKE_C_COMPILER)
   SET(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_WITH_PATH} CACHE STRING "C compiler" FORCE)
 ENDIF(CMAKE_C_COMPILER_WITH_PATH)
   ENDIF(NOT _CMAKE_USER_C_COMPILER_PATH)
+  message(STATUS "CMAKE_C_COMPILER now set to: -${CMAKE_C_COMPILER}-")
+
 ENDIF(NOT CMAKE_C_COMPILER)
 MARK_AS_ADVANCED(CMAKE_C_COMPILER)
 
@@ -101,6 +106,8 @@ IF (NOT _CMAKE_TOOLCHAIN_LOCATION)
   GET_FILENAME_COMPONENT(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_C_COMPILER}" PATH)
 ENDIF (NOT _CMAKE_TOOLCHAIN_LOCATION)
 
+message(STATUS "Toolchain location: -${_CMAKE_TOOLCHAIN_LOCATION}-")
+
 # Build a small source file to identify the compiler.
 IF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
   SET(CMAKE_C_COMPILER_ID_RUN 1)
@@ -149,12 +156,16 @@ ENDIF(NOT CMAKE_C_COMPILER_ID_RUN)
 # NAME_WE cannot be used since then this test will fail for names lile
 # "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be 
 # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
+message(STATUS "C Compiler ID: -${CMAKE_C_COMPILER_ID}-")
+message(STATUS "Toolchain prefix: -${_CMAKE_TOOLCHAIN_PREFIX}-")
 IF (CMAKE_CROSSCOMPILING  
 AND "${CMAKE_C_COMPILER_ID}" MATCHES "GNU"
 AND NOT _CMAKE_TOOLCHAIN_PREFIX)
+  message(STATUS "Getting toolchain location...")
   GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME)
   IF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(\\.exe)?$")
 SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
+message(STATUS "Got toolchain location: -${_CMAKE_TOOLCHAIN_PREFIX}- match1: -${CMAKE_MATCH_1}-")
   ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(\\.exe)?$")
 
   # if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils
___
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

Re: [CMake] Can CMake prompt the user for input while it's running?

2010-02-28 Thread Bill Hoffman

Matt Williams wrote:

On 28 February 2010 14:39, Bill Hoffman  wrote:

Off course the cmake UI would authorize to unfilter all vars
just as today there is the advanced/normal view.

You could just use the advanced/non-advanced to handle this. When you want
to show a variable to the user make it non-advanced.  This would work with
ccmake, cmake -i, and cmake-gui.  They all default to showing non-advanced
variables by default.


Except that DART_TESTING_TIMEOUT is for some reason set to
non-advanced (http://www.itk.org/Bug/view.php?id=10150) and so it will
show up in the list. Apart from that, I've found that this works very
well.

You can fix that in your project by marking it advanced yourself. 
mark_as_advanced(DART_TESTING_TIMEOUT) should do the trick, and time 
after you include ctest.


-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


Re: [CMake] Can CMake prompt the user for input while it's running?

2010-02-28 Thread Matt Williams
On 28 February 2010 14:39, Bill Hoffman  wrote:
>> Off course the cmake UI would authorize to unfilter all vars
>> just as today there is the advanced/normal view.
>
> You could just use the advanced/non-advanced to handle this. When you want
> to show a variable to the user make it non-advanced.  This would work with
> ccmake, cmake -i, and cmake-gui.  They all default to showing non-advanced
> variables by default.

Except that DART_TESTING_TIMEOUT is for some reason set to
non-advanced (http://www.itk.org/Bug/view.php?id=10150) and so it will
show up in the list. Apart from that, I've found that this works very
well.

-- 
Matt Williams
http://milliams.com
___
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

Re: [CMake] Can CMake prompt the user for input while it's running?

2010-02-28 Thread Bill Hoffman




Off course the cmake UI would authorize to unfilter all vars
just as today there is the advanced/normal view.


You could just use the advanced/non-advanced to handle this. When you 
want to show a variable to the user make it non-advanced.  This would 
work with ccmake, cmake -i, and cmake-gui.  They all default to showing 
non-advanced variables by default.


-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


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

2010-02-28 Thread Luigi Calori

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


Re: [CMake] Can CMake prompt the user for input while it's running?

2010-02-28 Thread Eric Noulard
2010/2/28 Naram Qashat :
>> Now since there is a "Grouped View" based on var name in CMake gui
>> you should be able to emulate what you want using
>> "conditionnal" option + cmake gui + grouped view.
>
> Most of our users are compiling our program under *nix and will not be using
> a GUI, which is why I was looking for a prompting solution instead.

OK I see.

> The suggestion in another part of this thread about using cmake -i won't just 
> it
> due to the number of options that come up that would be confusing to users.

Did you try ccmake ? (The "TUI" curse interface)
It should work on any text terminal and shows OPTION/VARS in alphabetical order
such that if you name your options beginning with "0_User_x"
they should come up first in the menu.

Then there is no "prompt" but the user can toggle ON/OFF option easily
and give appropriate value for other needed-to-be defined vars.

ccmake require the user to hit 'c' (configure) as many time as needed
before he can hit 'g' for generating the underlying build files.

Off course ccmake authorize the user to change other var/option
but on the contrary of cmake -i he won't be prompt to do it.

Note that your need makes me think of a may-be nice feature request
that would be to be able to 'tag' variables/option in order to be able to select
what should be shown/asked to the user.

aka something like a meta information about a variable,
currently there is one meta-info which CACHE which is
controlled by set and/or mark_as_advanced.

We may imagine a USER meta-info or even a list of "tag"
which may be used by cmake -i/ccmake/cmake-gui
in order to filter out unwanted var.

For example adding a:

tag_as(TAG  VAR VAR2 VAR...)
would be used to tag a list of var

and
show_only()

may indicate cmake tools to only show the vars
corresponding to te tag list.

Off course the cmake UI would authorize to unfilter all vars
just as today there is the advanced/normal view.
-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
___
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


Re: [CMake] How to install headers in a library

2010-02-28 Thread Michael Wild

On 28. Feb, 2010, at 11:09 , Hendrik Sattler wrote:

> Am Sonntag 28 Februar 2010 10:31:57 schrieb Giampiero Gabbiani:
>> Hi all,
>> I like very much the simplicity of cmake in comparison with the classic
>> autotools framework, but still I have two questions concerning the porting
>> of a Linux based project under cmake:
>> 
>> 1) when defining a library (shared or static) as a project target , I
>> expected that cmake would understand the architecture of the host machine
>> and install conseguently the libraries (.so or .a) in the correct /lib or
>> /lib64 path. Instead I noticed that I have to explicity set the
>> destination path
>> 
>> install(TARGETS  ARCHIVE DESTINATION lib64)
>> install(TARGETS  LIBRARY DESTINATION lib64)
>> 
>> This works well on my machine (a 64 bit system) but of course will not work
>> if anyone want to install on a 32 bit system.
>> 
>> So ... is there a way in order to let cmake automatically install on the
>> correct path according with the hosting system architecture?
>> 
>> 2) together with the resulting binaries libs (both archive and library) I
>> want to install also the corrisponding header(s) in /usr/local/include
>> path...how is it possible to do that?
> 
> You could use a variable to represent the directory. This would depend on the 
> existence of lib64/ (not all have this as directory, on Debian it's just a 
> compatibility link to lib/) and on SIZEOF_VOID_P being 8:
> set (LIBRARY_INSTALL_DIR lib)
> if (EXISTS "${CMAKE_INSTALL_PREFIX}/lib32/" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
>  set (LIBRARY_INSTALL_DIR lib32)
> elif (EXISTS "${CMAKE_INSTALL_PREFIX}/lib64/" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
>  set (LIBRARY_INSTALL_DIR lib64)
> endif ()
> 
> Or let the user set it.
> 
> HS

Such decisions I often handle like this:

- compute a sensible default, as Hendrik showed above.
- use that default to set a cache variable
- let the user override the default using the cache variables

In above example this would be:

# compute default library install dir
set (_DEFAULT_LIBRARY_INSTALL_DIR lib)
if (EXISTS "${CMAKE_INSTALL_PREFIX}/lib32/" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
 set (_DEFAULT_LIBRARY_INSTALL_DIR lib32)
elif (EXISTS "${CMAKE_INSTALL_PREFIX}/lib64/" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
 set (_DEFAULT_LIBRARY_INSTALL_DIR lib64)
endif ()
# the library install dir
set(LIBRARY_INSTALL_DIR "${_DEFAULT_LIBRARY_INSTALL_DIR}" CACHE PATH 
"Installation directory for libraries")
# make the library install dir an absolute path (can be important e.g. when 
using CONFIGURE_FILE to embed
# the library installation directory into a file)
if(NOT IS_ABSOLUTE "${LIBRARY_INSTALL_DIR}")
  set(LIBRARY_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIBRARY_INSTALL_DIR}")
endif()


Of course, you can extend the logic for the default selection to handle 
particularities of other platforms, such as Windows.

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


Re: [CMake] How to install headers in a library

2010-02-28 Thread Hendrik Sattler
Am Sonntag 28 Februar 2010 10:31:57 schrieb Giampiero Gabbiani:
> Hi all,
> I like very much the simplicity of cmake in comparison with the classic
> autotools framework, but still I have two questions concerning the porting
>  of a Linux based project under cmake:
> 
> 1) when defining a library (shared or static) as a project target , I
>  expected that cmake would understand the architecture of the host machine
>  and install conseguently the libraries (.so or .a) in the correct /lib or
>  /lib64 path. Instead I noticed that I have to explicity set the
>  destination path
> 
> install(TARGETS  ARCHIVE DESTINATION lib64)
> install(TARGETS  LIBRARY DESTINATION lib64)
> 
> This works well on my machine (a 64 bit system) but of course will not work
>  if anyone want to install on a 32 bit system.
> 
> So ... is there a way in order to let cmake automatically install on the
> correct path according with the hosting system architecture?
> 
> 2) together with the resulting binaries libs (both archive and library) I
>  want to install also the corrisponding header(s) in /usr/local/include
>  path...how is it possible to do that?

You could use a variable to represent the directory. This would depend on the 
existence of lib64/ (not all have this as directory, on Debian it's just a 
compatibility link to lib/) and on SIZEOF_VOID_P being 8:
set (LIBRARY_INSTALL_DIR lib)
if (EXISTS "${CMAKE_INSTALL_PREFIX}/lib32/" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
  set (LIBRARY_INSTALL_DIR lib32)
elif (EXISTS "${CMAKE_INSTALL_PREFIX}/lib64/" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
  set (LIBRARY_INSTALL_DIR lib64)
endif ()

Or let the user set it.

HS
___
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


[CMake] How to install headers in a library

2010-02-28 Thread Giampiero Gabbiani
Hi all,
I like very much the simplicity of cmake in comparison with the classic 
autotools framework, but still I have two questions concerning the porting of 
a Linux based project under cmake:

1) when defining a library (shared or static) as a project target , I expected 
that cmake would understand the architecture of the host machine and install 
conseguently the libraries (.so or .a) in the correct /lib or /lib64 path. 
Instead I noticed that I have to explicity set the destination path 

install(TARGETS  ARCHIVE DESTINATION lib64)
install(TARGETS  LIBRARY DESTINATION lib64)

This works well on my machine (a 64 bit system) but of course will not work if 
anyone want to install on a 32 bit system.

So ... is there a way in order to let cmake automatically install on the 
correct path according with the hosting system architecture?

2) together with the resulting binaries libs (both archive and library) I want 
to install also the corrisponding header(s) in /usr/local/include path...how 
is it possible to do that?

Many thanks in advance
Giampiero
___
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