[CMake] how to create library for a folder having only two sub folder

2009-01-28 Thread ankit jain
hi all,

I am a newbie to cmake. the problem iam facing is like this:

actually i hvae a folder which many sub folder. i cretaed a CmakeLists file
for very folder and i added them to the root Cmakelist file. now i have
successfully created the libraries for all the sub folders but i want a main
library to be build for the fodlers for which the separate libraries are
already build.

Please guide me how to do that.

Regards-
ankit jain
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

[CMake] error: multiple declaration of main

2009-01-28 Thread ankit jain
hi all,

in one of my folder i have three files. in each of them a main() function is
defined. now on building it says that multiple declaration of main. if i
compile the makefile using gcc only no such error had came.
Guide me what to do?

Regards-
ankit jain
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

[CMake] Include header files at run time through cmake

2009-01-28 Thread ankit jain
hi all,
i have a c file in a folder which contain the line #include "%h" which says
compile the file with -I option with gcc to tell where %h is located.
but in cmake as i already add the header files by defining the path through
a variable and add it through include_directories command. it still give
error on compiling that %h: no such file or directory found.

I am not able to understand how to remove it through cmake.

regards-
ankit jain
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] how to create library for a folder having only two sub folder

2009-01-29 Thread ankit jain
2009/1/29 Philip Lowman 

>  On Wed, Jan 28, 2009 at 11:49 PM, ankit jain wrote:
>
>> Hi philip,
>> Thanks for showing interest my query.
>>
>> Actually i have a folder name myapp. it has two sub folders sub1 and sub2
>> only.
>> these folders have some c files into it. i created the cmakelist file for
>> both the subfolders and with add_library command i created the library for
>> each of the sub folders. in the cmakelist file of myapp folder i add these
>> two sub folders name using add_subdirectory.
>>
>> now i have two libraries created for each of the folders. What i want now
>> is to create a library for the myapp folder which represent the entire
>> folder.
>>
>> since we dont add the add_library command in the cmakelist of myapp folder
>> i want to know how to create the library for the myapp folder.
>>
>> i hope it is clear to u now.
>>
>>
>
> So you want
>
> libA : A/foo.cc
> libB : B/bar.cc
>
> and a 3rd library:
> libC : A/foo.cc B/bar.cc
>
> ?
>

Yes exactly i want this only.

Ankit Jain

>
> Please always reply to list as others on-list can help with your query and
> those off-list can learn from it via search engines.
>
> --
> Philip Lowman
>
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] how to create library for a folder having only two sub folder

2009-01-29 Thread ankit jain
2009/1/29 Philip Lowman 

>  On Wed, Jan 28, 2009 at 11:49 PM, ankit jain wrote:
>
>> Hi philip,
>> Thanks for showing interest my query.
>>
>> Actually i have a folder name myapp. it has two sub folders sub1 and sub2
>> only.
>> these folders have some c files into it. i created the cmakelist file for
>> both the subfolders and with add_library command i created the library for
>> each of the sub folders. in the cmakelist file of myapp folder i add these
>> two sub folders name using add_subdirectory.
>>
>> now i have two libraries created for each of the folders. What i want now
>> is to create a library for the myapp folder which represent the entire
>> folder.
>>
>> since we dont add the add_library command in the cmakelist of myapp folder
>> i want to know how to create the library for the myapp folder.
>>
>> i hope it is clear to u now.
>>
>>
>
> So you want
>
> libA : A/foo.cc
> libB : B/bar.cc
>
> and a 3rd library:
> libC : A/foo.cc B/bar.cc
>
> ?
> This is what iam trying to do


ankit jain

>
> Please always reply to list as others on-list can help with your query and
> those off-list can learn from it via search engines.
>
> --
> Philip Lowman
>
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

[CMake] how to build library for this..

2009-01-29 Thread ankit jain
hi all,

Problem:

libA : A/foo.cc
libB : B/bar.cc
and a 3rd library:
libC : A/foo.cc B/bar.cc
?

here i build the libraries for A and B but not able to build lib for C .
Guide me to do that. What should be the content of cmakelist file of C to
create lib C

here A and B are sub folders of C


Regards-
ankit
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] how to build library for this..

2009-01-29 Thread ankit jain
2009/1/29 Pau Garcia i Quiles 

>  On Thu, Jan 29, 2009 at 1:12 PM, ankit jain  wrote:
> > hi all,
> >
> > Problem:
> >
> > libA : A/foo.cc
> > libB : B/bar.cc
> > and a 3rd library:
> > libC : A/foo.cc B/bar.cc
> > ?
> >
> > here i build the libraries for A and B but not able to build lib for C .
> > Guide me to do that. What should be the content of cmakelist file of C to
> > create lib C
> >
> > here A and B are sub folders of C
>
> Do you ean you are trying this but it's not working?
>
> ADD_LIBRARY (libA A/foo.cc )
> ADD_LIBRARY (libB B/bar.cc )
> ADD_LIBRARY (libC libA libB )
>
> That fails because CMake does not support convenience libraries:
>
> http://www.cmake.org/Wiki/CMake_FAQ#Does_CMake_support_.22convenience.22_libraries.3F
>
> You need to do this:
>
> ADD_LIBRARY (libA A/foo.cc )
> ADD_LIBRARY (libB B/bar.cc )
> ADD_LIBRARY (libC A/foo.cc B/bar.cc )
>
> I. e. list the source files for libC
>
> Is that what you want to do?
>

Dont you think so it will be too hectic if there are 10 folders inside
folder C and each folder has around 10 C files each. then listing all will
be really cumbersome.
What should be the alternative for it.

Ankit Jain

>
> --
> Pau Garcia i Quiles
> http://www.elpauer.org
> (Due to my workload, I may need 10 days to answer)
> ___
> CMake mailing list
> CMake@cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] how to build library for this..

2009-01-30 Thread ankit jain
Thanks for all the help its working.

Regards-
ankit jain

2009/1/30 Philip Lowman 

>   On Thu, Jan 29, 2009 at 11:38 PM, ankit jain wrote:
>
>>
>>
>> 2009/1/29 Pau Garcia i Quiles 
>>
>>>  On Thu, Jan 29, 2009 at 1:12 PM, ankit jain 
>>> wrote:
>>> > hi all,
>>> >
>>> > Problem:
>>> >
>>> > libA : A/foo.cc
>>> > libB : B/bar.cc
>>> > and a 3rd library:
>>> > libC : A/foo.cc B/bar.cc
>>> > ?
>>> >
>>> > here i build the libraries for A and B but not able to build lib for C
>>> .
>>> > Guide me to do that. What should be the content of cmakelist file of C
>>> to
>>> > create lib C
>>> >
>>> > here A and B are sub folders of C
>>>
>>> Do you ean you are trying this but it's not working?
>>>
>>> ADD_LIBRARY (libA A/foo.cc )
>>> ADD_LIBRARY (libB B/bar.cc )
>>> ADD_LIBRARY (libC libA libB )
>>>
>>> That fails because CMake does not support convenience libraries:
>>>
>>> http://www.cmake.org/Wiki/CMake_FAQ#Does_CMake_support_.22convenience.22_libraries.3F
>>>
>>> You need to do this:
>>>
>>> ADD_LIBRARY (libA A/foo.cc )
>>> ADD_LIBRARY (libB B/bar.cc )
>>> ADD_LIBRARY (libC A/foo.cc B/bar.cc )
>>>
>>> I. e. list the source files for libC
>>>
>>> Is that what you want to do?
>>>
>>
>> Dont you think so it will be too hectic if there are 10 folders inside
>> folder C and each folder has around 10 C files each. then listing all will
>> be really cumbersome.
>> What should be the alternative for it.
>>
>
> Here's one idea, in A and B set a variable with all of the source files and
> add them to the PARENT_SCOPE.
>
> set(A_SRCS a.cc)
> set(A_SRCS ${A_SRCS} PARENT_SCOPE)
> add_library(A ${A_SRCS})
>
> Then in the higher directory, use a foreach() loop to construct a proper
> relative path to each source file:
>
> foreach(fname ${A_SRCS})
> list(APPEND C_SRCS A/${fname})
> endforeach()
> foreach(fname ${B_SRCS})
> list(APPEND C_SRCS B/${fname})
> endforeach()
> add_library(both ${C_SRCS})
>
> --
> Philip Lowman
>
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

[CMake] how to specify path of header files at run time through cmake

2009-01-30 Thread ankit jain
hi all,

How can we specify the path of header fiels at run time through cmake since
i have a line in my C file as #include "%h"


Regards-
ankit jain
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

[CMake] equivalent cmakelist for this file

2009-02-02 Thread ankit jain
hi all,

Can anybody tell me what should be the equivalent cmakelists file should for
this makefile.

Makefile:

include Make.bootstrap
# List of descriptor files for test scripts
TEST_DESCRIPTORS = a.desc b.desc c.desc d.desc
include $(MAKEMANY)

here each .desc file has script like this:
For a.desc:

$exec_string = "./a";

Similarly for all desc files.

I am not able to write a equivalent cmake file for this so that exact output
will be produced as on making the simple makefile does.

Regards-
ankit jain
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] equivalent cmakelist for this file

2009-02-02 Thread ankit jain
Then what to do. Is something can be done using Ctest.

ankit

2009/2/2 Hendrik Sattler 

> ankit jain schrieb:
>  > Can anybody tell me what should be the equivalent cmakelists file
> should for
> > this makefile.
> >
> > Makefile:
> >
> > include Make.bootstrap
> > # List of descriptor files for test scripts
> > TEST_DESCRIPTORS = a.desc b.desc c.desc d.desc
> > include $(MAKEMANY)
> >
> > here each .desc file has script like this:
> > For a.desc:
> >
> > $exec_string = "./a";
> >
> > Similarly for all desc files.
> >
> > I am not able to write a equivalent cmake file for this so that exact
> output
> > will be produced as on making the simple makefile does.
>
> It's not "simple" but everything is hidden in the two included makefiles
>
> HS
> ___
> CMake mailing list
> CMake@cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] equivalent cmakelist for this file

2009-02-02 Thread ankit jain
The objective here to include all the .desc files in the cmakelist and when
we make it it should generate the executable for it like if we include
abc.desc then after make it should generate a file abc which is executable
and a script which has test cases but generated by .desc file only.
In order to achieve that guide me how to write cmake list file for it so
that it wiil produce equivalent behaviour as normal make does using unix
makefiles.

When we make to the unix makefiles it is generating the equivalent
executable mentioned inthat .desc file.

I want to achieve that through Cmakelist files.


AJ

2009/2/2 ankit jain 

> Actually my motive is to run executable that are executed through  .desc
> file. so how to write a cmakelist file for that.
>
>
> AJ
>
>  2009/2/2 Hendrik Sattler 
>
>> ankit jain schrieb:
>>
>> > Then what to do. Is something can be done using Ctest.
>>
>> We cannot guess what's in those files. Don't think about what the old
>> build system looks like but think about what you want to achieve.
>>
>> HS
>>
>
>
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

[CMake] Adding files other than c and cpp in cmakelists file

2009-02-02 Thread ankit jain
Hi all,

Can't we include our source files other than C or Cpp in cmakelists file. if
yes then if we want to execute those files when we do make then for that
what to write in CMakelists file as we write add_library command which we
want to do when make will run in some cases.

AJ
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] equivalent cmakelist for this file

2009-02-02 Thread ankit jain
Actually my motive is to run executable that are executed through  .desc
file. so how to write a cmakelist file for that.


AJ

2009/2/2 Hendrik Sattler 

> ankit jain schrieb:
> > Then what to do. Is something can be done using Ctest.
>
> We cannot guess what's in those files. Don't think about what the old
> build system looks like but think about what you want to achieve.
>
> HS
>
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

[CMake] Fwd: equivalent cmakelist for this file

2009-02-02 Thread ankit jain
-- Forwarded message --
From: ankit jain 
Date: 2009/2/2
Subject: Re: [CMake] equivalent cmakelist for this file
To: Bill Hoffman 




2009/2/2 Bill Hoffman 

 ankit jain wrote:
>
>> The objective here to include all the .desc files in the cmakelist and
>> when we make it it should generate the executable for it like if we include
>> abc.desc then after make it should generate a file abc which is executable
>> and a script which has test cases but generated by .desc file only. In order
>> to achieve that guide me how to write cmake list file for it so that it wiil
>> produce equivalent behaviour as normal make does using unix makefiles.
>>  When we make to the unix makefiles it is generating the equivalent
>> executable mentioned inthat .desc file.
>>  I want to achieve that through Cmakelist files.
>>
>>
>
> I am still not really sure what is in a .desc file.  Please restate your
> problem as if the .desc file did not exist.
>
> Something like:
>
> I want a cmakelists file that does this:
>
> 1. ...
> 2. ...
>
>
> Basically describe the functionality you want without describing the
> current makefile implementation of that functionality.  The currently
> implementation is most likely irrelevant to the cmake solution to the
> problem.
>
> -Bill
>
Actually these .desc file contain only one line as:
$exec_string = "./abc"

This abc contain shell script code.
Actually the cmakelist file should do:
1. this functionality to create ./abc this file should generate after
running make.

since this line is written in desc files thats why i write this to you.

You tell me how to create that using cmakelist file.

Ankit
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Fwd: equivalent cmakelist for this file

2009-02-02 Thread ankit jain
2009/2/3 Philip Lowman 

>   On Mon, Feb 2, 2009 at 11:31 PM, ankit jain wrote:
>
>>
>>
>>  -- Forwarded message --
>> From: ankit jain 
>> Date: 2009/2/2
>> Subject: Re: [CMake] equivalent cmakelist for this file
>> To: Bill Hoffman 
>>
>>
>>
>>
>>  2009/2/2 Bill Hoffman 
>>
>>  ankit jain wrote:
>>>
>>>> The objective here to include all the .desc files in the cmakelist and
>>>> when we make it it should generate the executable for it like if we include
>>>> abc.desc then after make it should generate a file abc which is executable
>>>> and a script which has test cases but generated by .desc file only. In 
>>>> order
>>>> to achieve that guide me how to write cmake list file for it so that it 
>>>> wiil
>>>> produce equivalent behaviour as normal make does using unix makefiles.
>>>>  When we make to the unix makefiles it is generating the equivalent
>>>> executable mentioned inthat .desc file.
>>>>  I want to achieve that through Cmakelist files.
>>>>
>>>>
>>>
>>> I am still not really sure what is in a .desc file.  Please restate your
>>> problem as if the .desc file did not exist.
>>>
>>> Something like:
>>>
>>> I want a cmakelists file that does this:
>>>
>>> 1. ...
>>> 2. ...
>>>
>>>
>>> Basically describe the functionality you want without describing the
>>> current makefile implementation of that functionality.  The currently
>>> implementation is most likely irrelevant to the cmake solution to the
>>> problem.
>>>
>>> -Bill
>>>
>> Actually these .desc file contain only one line as:
>> $exec_string = "./abc"
>>
>> This abc contain shell script code.
>> Actually the cmakelist file should do:
>> 1. this functionality to create ./abc this file should generate after
>> running make.
>>
>> since this line is written in desc files thats why i write this to you.
>>
>> You tell me how to create that using cmakelist file.
>>
>
> Ankit,
>
> More information is needed.  You can use the ADD_CUSTOM_COMMAND cmake
> command to run custom scripts but you need to clarify a bit further.  You
> mention "this functionality to create ./abc this file should generate after
> running make".  This isn't clear at all.  Are you trying to create a shell
> script (abc) with CMake code or do they already exist?  If they already
> exist you could parse the contents of the desc files using FILE(READ... and
> STRING(REGEX... but there may be a far easier solution to your problem.
> Without knowing what a "desc" file is or what these shell scripts do it's
> unlikely anyone's going to be able to offer any useful suggestions for you
> on this mailing list.
>
> --
> Philip Lowman
>

Suppose in unix makefile it is written like this:
$exec_string="./abc"

what i should write in cmakelist file so that what this command do same
thing happen after doing make. My purpose is to generate a file abc which
has some shell script code. this file not already exist in the folder but
should be generated on make.

Ankit
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Fwd: equivalent cmakelist for this file

2009-02-02 Thread ankit jain
2009/2/3 Philip Lowman 

>   On Mon, Feb 2, 2009 at 11:31 PM, ankit jain wrote:
>
>>
>>
>>  -- Forwarded message --
>> From: ankit jain 
>> Date: 2009/2/2
>> Subject: Re: [CMake] equivalent cmakelist for this file
>> To: Bill Hoffman 
>>
>>
>>
>>
>>  2009/2/2 Bill Hoffman 
>>
>>  ankit jain wrote:
>>>
>>>> The objective here to include all the .desc files in the cmakelist and
>>>> when we make it it should generate the executable for it like if we include
>>>> abc.desc then after make it should generate a file abc which is executable
>>>> and a script which has test cases but generated by .desc file only. In 
>>>> order
>>>> to achieve that guide me how to write cmake list file for it so that it 
>>>> wiil
>>>> produce equivalent behaviour as normal make does using unix makefiles.
>>>>  When we make to the unix makefiles it is generating the equivalent
>>>> executable mentioned inthat .desc file.
>>>>  I want to achieve that through Cmakelist files.
>>>>
>>>>
>>>
>>> I am still not really sure what is in a .desc file.  Please restate your
>>> problem as if the .desc file did not exist.
>>>
>>> Something like:
>>>
>>> I want a cmakelists file that does this:
>>>
>>> 1. ...
>>> 2. ...
>>>
>>>
>>> Basically describe the functionality you want without describing the
>>> current makefile implementation of that functionality.  The currently
>>> implementation is most likely irrelevant to the cmake solution to the
>>> problem.
>>>
>>> -Bill
>>>
>> Actually these .desc file contain only one line as:
>> $exec_string = "./abc"
>>
>> This abc contain shell script code.
>> Actually the cmakelist file should do:
>> 1. this functionality to create ./abc this file should generate after
>> running make.
>>
>> since this line is written in desc files thats why i write this to you.
>>
>> You tell me how to create that using cmakelist file.
>>
>
> Ankit,
>
> More information is needed.  You can use the ADD_CUSTOM_COMMAND cmake
> command to run custom scripts but you need to clarify a bit further.  You
> mention "this functionality to create ./abc this file should generate after
> running make".  This isn't clear at all.  Are you trying to create a shell
> script (abc) with CMake code or do they already exist?  If they already
> exist you could parse the contents of the desc files using FILE(READ... and
> STRING(REGEX... but there may be a far easier solution to your problem.
> Without knowing what a "desc" file is or what these shell scripts do it's
> unlikely anyone's going to be able to offer any useful suggestions for you
> on this mailing list.
>
> --
> Philip Lowman
>

.desc files are descriptor files for test scripts
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

[CMake] Is it necessary to link a executable file?

2009-02-04 Thread ankit jain
Hi all,

I have created executable file from C files. is it necessary to link them to
some directories. if dont want to do so is ther any problem? Can i do that?

Actually since iam not linking it with any library iam facing a problem. but
if i create a library of those files or linking them to any other library
its working fine.

Guide this newbie...

AJ
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Is it necessary to link a executable file?

2009-02-04 Thread ankit jain
2009/2/4 ankit jain 

> Hi all,
>
> I have created executable file from C files. is it necessary to link them
> to some directories. if dont want to do so is ther any problem? Can i do
> that?
>
> Actually since iam not linking it with any library iam facing a problem.
> but if i create a library of those files or linking them to any other
> library its working fine.
>
> Guide this newbie...
>
> AJ
>

Actually in this case i dont want to create libraries thats why iam
wondering whether making only executable is permissble or not?

AJ

>
>
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

[CMake] Fwd: Fwd: Is it necessary to link a executable file?

2009-02-04 Thread ankit jain
-- Forwarded message --
From: ankit jain 
Date: 2009/2/4
Subject: Re: [CMake] Fwd: Is it necessary to link a executable file?
To: Eric Noulard 




2009/2/4 Eric Noulard 

 2009/2/4 ankit jain :
> >>
> >> 2009/2/4 ankit jain :
> >>
> >> > Actually in this case i dont want to create libraries thats why iam
> >> > wondering whether making only executable is permissble or not?
> >>
> >> If you use
> >> ADD_EXECUTABLE
> >>
> >> it should work just fine.
> >> --
> >> Erk
> >
> > I am using that only but it gives error because it goea to the folder
> > /usr/lib and try to link it with some .o file.
>
> As already told by others here you should give us
> more precise informations about your problem. At least,
>
> - the CMakeLists.txt you are using or the portion which seems to lead
> to an error.
> - the verbatim copy of the error you are observing.
>
> without that we may not help you.
>
> --
> Erk
>

The CMakeLists iam using contains:

PROJECT(hello)

ADD_EXECUTABLE(hello h1.C)

Error iam getting is:

Linking CXX executable hello
/usr/lib/gcc-lib/i386-redhat-linux/3.2.3/../../../crt1.o(.text+0x18): In
function `_start':
: undefined reference to `main'
AJ
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

[CMake] Fwd: Is it necessary to link a executable file?

2009-02-04 Thread ankit jain
-- Forwarded message --
From: ankit jain 
Date: 2009/2/4
Subject: Re: [CMake] Is it necessary to link a executable file?
To: Eric Noulard 




2009/2/4 Eric Noulard 

2009/2/4 ankit jain :
>
> > Actually in this case i dont want to create libraries thats why iam
> > wondering whether making only executable is permissble or not?
>
> If you use
> ADD_EXECUTABLE
>
> it should work just fine.
> --
> Erk
>

I am using that only but it gives error because it goea to the folder
/usr/lib and try to link it with some .o file.

AJ
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Fwd: Fwd: Is it necessary to link a executable file?

2009-02-04 Thread ankit jain
2009/2/4 Eric Noulard 

> 2009/2/4 ankit jain :
> >
> > The CMakeLists iam using contains:
> >
> > PROJECT(hello)
> >
> > ADD_EXECUTABLE(hello h1.C)
> >
> > Error iam getting is:
> >
> > Linking CXX executable hello
> > /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/../../../crt1.o(.text+0x18): In
> > function `_start':
> > : undefined reference to `main'
>
> This is not a CMake error this is a C++ error
> your source file is lacking the main() function thus
> the compiler cannot produce an executable.
>
> I bet that if you search for " undefined reference to `main' " on the Web
> you'll find the answer to such question.
>
> --
> Erk
>

But if i replace ADD_EXECUTABLE by ADD_LIBRARY there is no error and a
library get successfully built.


AJ
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

[CMake] linking error with libraries

2009-02-05 Thread ankit jain
Hi,
Actually iam linking an excutable to the libraries which is not in the
curretn project meanas they are in other folder outside it.

i am linking it using target link libraries by giving the entire path of the
libraries but still it shows error .

if I am missing something please tell me what else ned to be done.

AJ
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

[CMake] Fwd: MSVC7.1 static link question

2009-02-10 Thread ankit jain
-- Forwarded message --
From: ankit jain 
Date: 2009/2/11
Subject: Re: [CMake] MSVC7.1 static link question
To: Brad King 




2009/2/10 Brad King 

  Luigi Calori wrote:
>
>> Bill Hoffman ha scritto:
>>
>>> Philip Lowman wrote:
>>>
>>>> On Mon, Feb 9, 2009 at 12:39 PM, Luigi Calori >>> l.cal...@cineca.it>> wrote:
>>>>
>>>>I' m quite a newbie in static linking, I would like to combine two
>>>> lib
>>>>into one:
>>>>say libtiff needs libjpeg and zlib
>>>>If you generate them separately, then when you build an executable
>>>> that
>>>>needs libtiff, you have to link also libjpeg and zlib otherwise unref
>>>>happens
>>>>It is possible, under VisualStudio interface, to specify libjpeg.lib
>>>> and
>>>>zlib.lib as Additional Dependencies
>>>>This way (even if the linker show warnings as duplicate symbols) I
>>>>obtain a libtiff that can be used alone.
>>>>My question is: can I obtain the same result with cmake?
>>>>I' ve tried to use TARGET_LINK_LIBRARIES, that is perfecly working
>>>> for
>>>>exe and SHARED linkage but no success: the
>>>>vs project has always the Additional Dependencies field empty.
>>>>
>>>>Am I completely missing something?
>>>>
>>>> CMake does not work that way since it is not achievable cross platform.
>>>  If you project is CMake based CMake will chain the libraries.  If you use
>>> other build tools then you will have to explicitly list libjpeg and zlib
>>> with the libtiff.  To do this in CMake you have two options:
>>>
>>> 1. have a library that uses libtiff
>>> add_library(mylib ...)
>>> target_link_libraries(mylib libtiff libjepg zlib)
>>> add_executable(myexe ...)
>>> target_link_libraries(myexe mylib)  # will link in tiff jpeg and zlib
>>>
>>> 2. create an imported target for libtiff
>>> add_library(libtiff IMPORTED)
>>> set_target_properties(libtiff PROPERTIES IMPORTED_LOCATION
>>> /path/to/libtiff.lib)
>>> target_link_libraries(libtiff libjpeg zlib)
>>> add_executable(myexe ...)
>>> target_link_libraries(myexe libtiff) # will link jpeg and zlib
>>>
>>>
>>> -Bill
>>>
>>>
>>>
>>> Hi Philip and Bill:
>>
>> I tried Philip suggestion and it seem working: it adds the flags as
>> Additiona Optins in the commandline form and it seems to produce a
>> libtiff.lib that links ok.
>> The problem is that STATIC_LIBRARY_FLAGS property is not differentiated
>> between Debug / Release.
>>
>> Bill, is your method equivalent?
>>
>> Is your suggestion applicable if the  exe and the lib stay in two
>> completely different projects?
>>
>> What I mean is that I ' m willing to have a CMake project that BUILDS and
>> install libtiff.lib (static)
>>
>> Then I have another project that build a .dll (or .exe, I think it behave
>> the same) that Find and use my libtiff.lib.
>>
>> Both your suggested method  seem to assume that myexe and libtiff are
>> built at the same time.
>> This is not my case, I would like build libtiff static on win32 in such a
>> way that allow other projects (built with cmake) to link it without adding
>> explicitly the other dependent libraries.
>> so to not require changes in the dependent project (it is actually
>> OpenSceneGraph, Philip)
>> So either modifying VS project or adding STATIC_LIBRARY_FLAGS I  am able
>> to do.
>>
>> I tried to use IMPORTED bud it did not worked
>>
>
> Bill's example will not work as written.  The target_link_libraries command
> does not work for imported targets.  See IMPORTED target and general
> packaging documentation here:
>
>  http://www.cmake.org/Wiki/CMake_2.6_Notes#Exporting_and_Importing_Targets
>  http://www.cmake.org/Wiki/CMake_2.6_Notes#Packages
>
> CMake 2.6 makes it easy to export targets from one project (either its
> build tree or install tree) for use by another project.
>
> -Brad
>


>  If our library which we want to link is not in the curre tn project and
> we linkan executable to it through target_link_libraries by giving it entire
> path like /another/project/lib, will it not work properly. is it compulsory
> to use import and export targets for it.
>

Ankit

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

[CMake] Efficient linking to libraries(static and dynamic)

2009-02-10 Thread ankit jain
Hi all,

I have folder f1 having csome cpp files. structure is like this:
f1
c1.cpp
c2.cpp

now i create an executable for it as
add_executable(myexe c1.cpp c2.cpp)

the path of f1 folder is /home/ankit/mycode/f1
now i want to link myexe to a library lib.so and lib1.a which are not in
this folder but resides in other folder suppose in lib whose path is
something like this:

/home/ankit/mycode/lib/lib.so
/home/ankit/mycode/lib/lib1.a

How to do achieve this linkage so that no unref came.
Right now iam doing it usinmg target_link_libraries by giving the entire
path somthing like this:

target_link_libraries(myexe /home/ankit/mycode/lib/lib.so
/home/ankit/mycode/lib/lib1.a)

but it gives some unrefs. i dont know why.

Can u tell me how to achieve it.

Regards-
Ankit
___
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] Problem with PARENT_SCOPE

2009-02-11 Thread ankit jain
Hi all,

Actually i am usinf PARENT_SCOPE property but facing some problem.

the directory structure i have is like this
f1
...f2
.f3 (inside f2)
 i.e f1 has f2 folder and f2 has f3

in f3 i have demo.cpp file

i set a variable for this file as set(myvar demo.cpp)
Also i did set(myvar1 ${myvar} PARENT_SCOPE)

Due to this now myvar1 should be visible in f2 which has value demo.cpp

now what i want actually is that myvar1 should be visible in f1 but if did
like this in f2:
set(myvar2 ${myvar1} PARENT_SCOPE)

it is not working. i dont know why.
Is iam doing something wrong.

Please guide me how to make a variable of folder f3 visible in folder f1

Regards-
Ankit
___
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] Fwd: Problem with PARENT_SCOPE

2009-02-11 Thread ankit jain
-- Forwarded message --
From: ankit jain 
Date: 2009/2/12
Subject: Problem with PARENT_SCOPE
To: cmake@cmake.org


Hi all,

Actually i am usinf PARENT_SCOPE property but facing some problem.

the directory structure i have is like this
f1
...f2
.f3 (inside f2)
 i.e f1 has f2 folder and f2 has f3

in f3 i have demo.cpp file

i set a variable for this file as set(myvar demo.cpp)
Also i did set(myvar1 ${myvar} PARENT_SCOPE)

Due to this now myvar1 should be visible in f2 which has value demo.cpp

now what i want actually is that myvar1 should be visible in f1 but if did
like this in f2:
set(myvar2 ${myvar1} PARENT_SCOPE)

it is not working. i dont know why.
Is iam doing something wrong.

Please guide me how to make a variable of folder f3 visible in folder f1

Regards-
Ankit

Hi all,

Its working now
The problem is that i have to set the variable parent scope line after
adding the subdirectory.

Ankit
___
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] Setting macro while compiling through cmake

2009-02-12 Thread ankit jain
Hi all,

If i want to compile through g++ as:

g++ -Dname=value

The same if i want to do with cmake how to do it. Whether i need to make
some entry in CMakeCache.txt or somewhere else?

Ankit
___
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] setting environment variable through cmake

2009-02-16 Thread ankit jain
Hi all,

I want to set an enviromnet varibale but not able to do it.
Currently iam using the command:
SET( ENV{varname} value )

But it is not working.
Can anybody guide me how to do it by giving an example.


Ankit
___
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] Fwd: setting environment variable through cmake

2009-02-16 Thread ankit jain
-- Forwarded message --
From: ankit jain 
Date: 2009/2/17
Subject: Re: [CMake] setting environment variable through cmake
To: Philip Lowman 


2009/2/17 Philip Lowman 

 On Mon, Feb 16, 2009 at 7:46 AM, ankit jain  wrote:
>
>> Hi all,
>>
>> I want to set an enviromnet varibale but not able to do it.
>> Currently iam using the command:
>> SET( ENV{varname} value )
>>
>> But it is not working.
>> Can anybody guide me how to do it by giving an example.
>>
>
> Are you trying to set an environment variable that can be used during build
> time?  This isn't possible.
>
> http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_get_or_set_environment_variables.3F
>
> Could you elaborate on when you need the environment variable?
>


> I need to set the environment variable at the time of testing since my test
> needs two environment variable that need to be set fro running the tests.
>
Iam using cmake 2.6



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

[CMake] Working with make test

2009-02-16 Thread ankit jain
Hi all,

Actually my test cases are written in  C files. os iam creating executable
for that nad directly run the executbale through make.

Is it necessary to do it like "make test"?

If iam not doing is it iam missing something.

Apart form them i have some of my test cases defined in .tsh files which i
dont know how to handle it with cmake.
Does any body have any idea how to deal with these type of files.

Any help in thi regard will be highly appreciated.

Regards-
Ankit
___
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] Problem with testing with cmake

2009-02-18 Thread ankit jain
Hi all,

I have a directory structure with follwoign cmakelist as:

myfold
Cmakelist.txt
subfolder

subfolder
Cmakelists.txt
myfile.cpp

Contents of Cmakelist of subfolder:

add_executable(myfile myfile.cpp)
target_link_libraries(myfile mylib)
add_test(t1 myfile)

t1 is the test case defined in myfile.cpp whose executable i have made.

Contents of Camkelist of myfolder:

Project(myfolder)
ENABLE_TESTING()
add_subdirectory(subfolder)

Now when i am running make test from the myfolder directory on the prompt it
says test failed and saying error with ctest.

Iam not able to know whether my way of testing is right or not. i am sure
that it is wrong but dont know where.

Can anybody tell me where iam wrong. I reasd the documentation realted to
add_test and ctest but not getting proper example to clear my doubts.

Apart from that i more thing i want to know is that the name of the test  we
are giving in add_test() command as its first argument is the name of the
test that is defined in the executable which we have made.

Since iam using it first time iam not clear about all these and
documentationdoes nto clearify my doubts.

I request if anybody give me an example or whatever ia haev given to tell me
the right way of testing through cmake.

Any suggestion  in this will be really a great help for me.

Any further information if required that i am missing plz let me know.

Regards-
Ankit
___
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 redirect the output of an executable while testing

2009-02-23 Thread ankit jain
Hi all,

I have an executable having some test cases. I want to give some arguments
to it which i will give it through  add_test command. but my objective is to
write the output of the executable to a file at run tiem itself.

How to do that?

Secondly i want ot use this file in which output of executable is written as
an argument to other test case.

How to achieve that?


Ankit
___
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] Generating shell script through cmake

2009-02-25 Thread ankit jain
Hi,

I want to generate a shell script which should be executable through three
files.

first file has some macros with other functions and other code.
Second and third file haev definitions fot he macro the functions.

Can i generate a shell script from all this.

Ankit
___
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] Unlinking a library at run time for an executable

2009-02-27 Thread ankit jain
Hi ,

I have defined a variable for a set of libraries that i want to link with
some executables.

But with one executble i dont want to use one of the library from the set of
libraries.

Can i unlink that particular library for this executable since iam using a
variable for all those libraries.

Eg:  Folder main Cmakelist
set( var
  path/l1.so
path/l1.so
path/l2.so
path/l3.so
path/l4.so
path/l5.so
path/l6.so
path/l7.so
path/l8.so
path/l9.so)
 add_subdirectory(f1)
add_subdirectory(f2)


f1
 ...a1.C
CMakeList for f1 contains:
add_executable(a1 a1.C)
target_link_libraries(a1 ${var})


 f2
 ...a2.C
CMakeList for f2 contains:
add_executable(a2 a2.C)

Now for this i dont want the l9 library. one way is to explicitly link all
the other libraries.
Is there any other way by which i can specifically unlink this library l9 or
say able to link only other libraries.

Ankit
___
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] Fwd: setting environment variable through cmake

2009-03-06 Thread ankit jain
2009/2/17 Philip Lowman 

>   On Mon, Feb 16, 2009 at 11:03 PM, ankit jain wrote:
>
>>
>>
>> -- Forwarded message --
>> From: ankit jain 
>> Date: 2009/2/17
>> Subject: Re: [CMake] setting environment variable through cmake
>> To: Philip Lowman 
>>
>>
>> 2009/2/17 Philip Lowman 
>>
>>  On Mon, Feb 16, 2009 at 7:46 AM, ankit jain wrote:
>>>
>>>> Hi all,
>>>>
>>>> I want to set an enviromnet varibale but not able to do it.
>>>> Currently iam using the command:
>>>> SET( ENV{varname} value )
>>>>
>>>> But it is not working.
>>>> Can anybody guide me how to do it by giving an example.
>>>>
>>>
>>> Are you trying to set an environment variable that can be used during
>>> build time?  This isn't possible.
>>>
>>> http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_get_or_set_environment_variables.3F
>>>
>>> Could you elaborate on when you need the environment variable?
>>>
>>
>>
>>> I need to set the environment variable at the time of testing since my
>>> test needs two environment variable that need to be set fro running the
>>> tests.
>>>
>> Iam using cmake 2.6
>>
>
> This should work on the latest CMake 2.6.3 RC, provided you use "make
> test".
>
> set_tests_properties(foo PROPERTIES ENVIRONMENT foo=bar)
>
>   I have run this but not able to set the environment variable.

 I am using cmake-2.6.3-RC-14-Linux-i386.
 Actually i have a test t1. i want to set and unset LD_LIBRARY_PATH acc.
while adding  test t1 so that on running ctest it will use that value of
LD_LIBRARY_PATH rather than using the older set value.

This iam not able to achieve that.

Guide where iam wrong and what need to be done.


Ankit
___
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] setting and unsetting already existing enviroment varibale at the time of testing

2009-03-08 Thread ankit jain
Hi all,

It seems that there is problem existing with setting and unsetting already
existing environment variable like LD_LIBRARY_PATH for a  particular test.

If somebody knows any improvement in that regard please let me know.

Actually i want to unset and set the LD_LIBRARY_PATh varibale for my tests
it is something like this:

add_executable(e1 c1.cpp)
add_test(t1 e1)
set_tests_properties(t1 PROPERTIES ENVIRONMENT LD_LIBRARY_PATH=)#for
setting the library path to empty
  OR
set_tests_properties(t1 PROPERTIES ENVIRONMENT LD_LIBRARY_PATH=/usr/lib)
#i.e some other path

This thing actually does work with my case. iam using "make test".

If iam doing soemthing wrong please let me know or if this thing is in
progress of development kindly let me know the alternative that can be done
for achieving this thing.

Regards-
ankit jain
___
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] install question

2009-03-10 Thread ankit jain
-- Forwarded message --
From: ankit jain 
Date: 2009/3/10
Subject: Re: [CMake] install question
To: Sharon Melamed 



2009/3/10 Sharon Melamed 

>Hi,
>
>
>
> My main CmakeList.txt file look like this:
>
>
>
> cmake_minimum_required (VERSION 2.6)
>
> project (vos)
>
>
>
> add_subdirectory (system  BUILD)
>
> add_subdirectory (osal BUILD)
>
> add_subdirectory (logger BUILD)
>
> add_subdirectory (loggerConfigTool BUILD)
>
> add_subdirectory (voltSyslogd BUILD)
>
> add_subdirectory (chassis BUILD)
>
> add_subdirectory (eventHandler BUILD)
>
>
>
> in the system subdirectory the CmakeList.txt file look like this:
>
>
>
> set(main_SRCS main.cpp)
>
>
>
> include_directories(${vos_SOURCE_DIR}/include)
>
> link_directories(${vos_SOURCE_DIR}/BUILD)
>
>
>
> add_executable(vos ${main_SRCS})
>
>
>
> target_link_libraries(vos rt pthread logger osal)
>
> install(TARGETS vos RUNTIME DESTINATION /bin )
>
>
>
> After running cmake the make install command builds the vos executable but
> does not install it.
>
> I looked in install_manifest.txt and it was empty.
>
>
>
> Any ideas what I’m doing wrong?
>
>
>
> Thanks.
>
>
>
> Sharon.
> Hi,


I too facing the same problem. i too dont find those executables in the
destination folder specified. i dotn understand why they are not installing.

Ankit

>
> ___
> 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] install question

2009-03-10 Thread ankit jain
2009/3/10 Sharon Melamed 

>  Hi,
>
>
>
> My main CmakeList.txt file look like this:
>
>
>
> cmake_minimum_required (VERSION 2.6)
>
> project (vos)
>
>
>
> add_subdirectory (system  BUILD)
>
> add_subdirectory (osal BUILD)
>
> add_subdirectory (logger BUILD)
>
> add_subdirectory (loggerConfigTool BUILD)
>
> add_subdirectory (voltSyslogd BUILD)
>
> add_subdirectory (chassis BUILD)
>
> add_subdirectory (eventHandler BUILD)
>
>
>
> in the system subdirectory the CmakeList.txt file look like this:
>
>
>
> set(main_SRCS main.cpp)
>
>
>
> include_directories(${vos_SOURCE_DIR}/include)
>
> link_directories(${vos_SOURCE_DIR}/BUILD)
>
>
>
> add_executable(vos ${main_SRCS})
>
>
>
> target_link_libraries(vos rt pthread logger osal)
>
> install(TARGETS vos RUNTIME DESTINATION /bin )
>
>
>
> After running cmake the make install command builds the vos executable but
> does not install it.
>
> I looked in install_manifest.txt and it was empty.
>
>
>
> Any ideas what I’m doing wrong?
>
>
>
> Thanks.
>
>
>
> Sharon.
> It woking now for me..

Check your CMAKE_INSTALL_PREFIX path whatever u have set. By default on
linux it is set to /usr/local but if u want it to something else you can set
it in CMakeCache.txt file.

Hope it will work ..

Ankit

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

[CMake] Linking cmake build library to a shell script

2009-03-12 Thread ankit jain
Hi all,

I have a shell script. I want to link it with a library that i have build
using cmake. Is it possible to do so.
I am running this shell script using cmake.

If possible plz let me show an example.


Ankit
___
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] install question

2009-03-13 Thread ankit jain
2009/3/10 Sharon Melamed 

>  Hi,
>
>
>
> My main CmakeList.txt file look like this:
>
>
>
> cmake_minimum_required (VERSION 2.6)
>
> project (vos)
>

Same thing happens to me also. The problem is of RPATH settings. the path
your cmakelist links to while installing is not set for the sub directories
when you try to build and install it from your main directory "vos".
Therefore you need to do the following:

# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH  FALSE)

# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

# the RPATH to be used when installing
SET(CMAKE_INSTALL_RPATH "/bin")

# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

after doing this once when you do make install it will work and install the
exeutabled in /bin.
No need to set all this variables in the sub directory. it is valid for all
sub dirs.

For further inf. on RAPTH refer this link:
http://www.cmake.org/Wiki/CMake_RPATH_handling

It provide all details pertainign to RPATH settings.

Hope all this will work for you.

Ankit




>
>
> add_subdirectory (system  BUILD)
>
> add_subdirectory (osal BUILD)
>
> add_subdirectory (logger BUILD)
>
> add_subdirectory (loggerConfigTool BUILD)
>
> add_subdirectory (voltSyslogd BUILD)
>
> add_subdirectory (chassis BUILD)
>
> add_subdirectory (eventHandler BUILD)
>
>
>
> in the system subdirectory the CmakeList.txt file look like this:
>
>
>
> set(main_SRCS main.cpp)
>
>
>
> include_directories(${vos_SOURCE_DIR}/include)
>
> link_directories(${vos_SOURCE_DIR}/BUILD)
>
>
>
> add_executable(vos ${main_SRCS})
>
>
>
> target_link_libraries(vos rt pthread logger osal)
>
> install(TARGETS vos RUNTIME DESTINATION /bin )
>
>
>
> After running cmake the make install command builds the vos executable but
> does not install it.
>
> I looked in install_manifest.txt and it was empty.
>
>
>
> Any ideas what I’m doing wrong?
>
>
>
> Thanks.
>
>
>
> Sharon.
>
> ___
> 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] Linking cmake build library to a shell script

2009-03-13 Thread ankit jain
2009/3/13 Mattias Helsing 

> Hello Ankit,
>
> On 3/13/09, ankit jain  wrote:
> > Hi all,
> >
> > I have a shell script. I want to link it with a library that i have build
> > using cmake. Is it possible to do so.
> > I am running this shell script using cmake.
>
> You need to describe what you want to do in much more detail. What
> kind of link are you talking about? The first interpretation I made
> was that you are using a linker to link a library and a shell script
> into . Is it that you
> * want to call the linker from the script?
> * linking them in the context of packaging so they get installed together?
> * 
>
> Perhaps you could take a look at
>  http://www.catb.org/~esr/faqs/smart-questions.html
> so that we(I or any real cmake expert) can at least have a chance of
> helping you without wild guesses.
>
> Mattias
>


>  Iam sorry that i am not able to explain you properly.
>
Actually in my shl scripts there are certains commadns that i use. these
commands are nothing but executbale which require some arguments. these
executables are actaully created by cmake. Also certain commands can only be
run from some libraries which are build by cmake.

I am actually getting errors while running that shell script.
Error are like:  not found.
It is because iam not able to link that shell script or say not able to
include that library into the shell script. I dotn know how to link a
library with shell script so that while executing it gets all the supor tof
the library which it requires.

As you have asked about linker  not explicitly iam passing anything to
linker calling linker from shell script.

My need is to simple run the shell script which need a support of a library.
Toa chieve it how to link thast library to shell script i dont know. It
might be like you said calling linker from shell script. i dontknow how it
can be achieved.

You tell me in general sense if this the senario how to do it.

I hope i make problem somewhat clear to you.

Ankit

>
> >
> > If possible plz let me show an example.
> >
> >
> > Ankit
> >
>
___
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] Linking cmake build library to a shell script

2009-03-16 Thread ankit jain
2009/3/16 Mattias Helsing 

> Hello Ankit,
>
> I think I know what you are trying to do. Correct me if I'm wrong.
>
> Your CMake code produces an executable file (you can't run libraries
> from the commandline) and you want to produce a shellscript that calls
> this executable?
>

Thanks for the reply but iam sorry that you misunderstand my question.
My cmake genrates a library. iam not generating a shel script from cmake.
i already written it. only thing is that iam esxecuting this shell script
through cmake like normal executables. what i want is to link this shell
script with the cmake generated library.
thats it. like we link a cmake generated executable to cmake generated
library.
here the diff. is that the shell script is not generatde by cmake.

Hope its clear.iam giving my folder structure to you.

Main
cmakelist.txt
shell_script.sh



> Libraries are stored in some other folder outside main folder.
>
ankit


> You could for example create a shell script template and use the
> configure_file command, e.i.
>
> in file shscript.sh.in:
> #!/bin/sh
> #
> @PROJECT_BINARY_DIR@/bin/@TARGET_NAME@ $1 $2 $3
>
> in file CMakeLists.txt
> set(TARGET_NAME )
> configure_file(shscript.sh.in ${PROJECT_BINARY_DIR}/bin/shscript.sh)
>
> not at all the prettiest solution and I'm not really sure why you want
> to do this but good luck
> Mattias
>
> On 3/13/09, ankit jain  wrote:
> > 2009/3/13 Mattias Helsing 
> >
> >> Hello Ankit,
> >>
> >> On 3/13/09, ankit jain  wrote:
> >> > Hi all,
> >> >
> >> > I have a shell script. I want to link it with a library that i have
> >> > build
> >> > using cmake. Is it possible to do so.
> >> > I am running this shell script using cmake.
> >>
> >> You need to describe what you want to do in much more detail. What
> >> kind of link are you talking about? The first interpretation I made
> >> was that you are using a linker to link a library and a shell script
> >> into . Is it that you
> >> * want to call the linker from the script?
> >> * linking them in the context of packaging so they get installed
> >> together?
> >> * 
> >>
> >> Perhaps you could take a look at
> >>  http://www.catb.org/~esr/faqs/smart-questions.html
> >> so that we(I or any real cmake expert) can at least have a chance of
> >> helping you without wild guesses.
> >>
> >> Mattias
> >>
> >
> >
> >>  Iam sorry that i am not able to explain you properly.
> >>
> > Actually in my shl scripts there are certains commadns that i use. these
> > commands are nothing but executbale which require some arguments. these
> > executables are actaully created by cmake. Also certain commands can only
> > be
> > run from some libraries which are build by cmake.
> >
> > I am actually getting errors while running that shell script.
> > Error are like:  not found.
> > It is because iam not able to link that shell script or say not able to
> > include that library into the shell script. I dotn know how to link a
> > library with shell script so that while executing it gets all the supor
> tof
> > the library which it requires.
> >
> > As you have asked about linker  not explicitly iam passing anything to
> > linker calling linker from shell script.
> >
> > My need is to simple run the shell script which need a support of a
> > library.
> > Toa chieve it how to link thast library to shell script i dont know. It
> > might be like you said calling linker from shell script. i dontknow how
> it
> > can be achieved.
> >
> > You tell me in general sense if this the senario how to do it.
> >
> > I hope i make problem somewhat clear to you.
> >
> > Ankit
> >
> >>
> >> >
> >> > If possible plz let me show an example.
> >> >
> >> >
> >> > Ankit
> >> >
> >>
> >
>
___
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] Linking cmake build library to a shell script

2009-03-16 Thread ankit jain
2009/3/16 Mattias Helsing 

> Hi Ankit,
>
> ok, so we have problems with our terminologies. You can't link a shell
> script with anything!
>
> So back to guessing. This time I'm guessing that you (or your script)
> isn't setting LD_LIBRARY_PATH correctly. Could you check this?
>
> Mattias
>



>  Thanks Mattias. There was problem with LD_LIBRARY_PATH only.
>
Thanks for all your support and interest in my query.

Ankit

>
> On 3/16/09, ankit jain  wrote:
> > 2009/3/16 Mattias Helsing 
> >
> >> Hello Ankit,
> >>
> >> I think I know what you are trying to do. Correct me if I'm wrong.
> >>
> >> Your CMake code produces an executable file (you can't run libraries
> >> from the commandline) and you want to produce a shellscript that calls
> >> this executable?
> >>
> >
> > Thanks for the reply but iam sorry that you misunderstand my question.
> > My cmake genrates a library. iam not generating a shel script from cmake.
> > i already written it. only thing is that iam esxecuting this shell script
> > through cmake like normal executables. what i want is to link this shell
> > script with the cmake generated library.
> > thats it. like we link a cmake generated executable to cmake generated
> > library.
> > here the diff. is that the shell script is not generatde by cmake.
> >
> > Hope its clear.iam giving my folder structure to you.
> >
> > Main
> > cmakelist.txt
> > shell_script.sh
> >
> >
> >
> >> Libraries are stored in some other folder outside main folder.
> >>
> > ankit
> >
> >
> >> You could for example create a shell script template and use the
> >> configure_file command, e.i.
> >>
> >> in file shscript.sh.in:
> >> #!/bin/sh
> >> #
> >> @PROJECT_BINARY_DIR@/bin/@TARGET_NAME@ $1 $2 $3
> >>
> >> in file CMakeLists.txt
> >> set(TARGET_NAME )
> >> configure_file(shscript.sh.in ${PROJECT_BINARY_DIR}/bin/shscript.sh)
> >>
> >> not at all the prettiest solution and I'm not really sure why you want
> >> to do this but good luck
> >> Mattias
> >>
> >> On 3/13/09, ankit jain  wrote:
> >> > 2009/3/13 Mattias Helsing 
> >> >
> >> >> Hello Ankit,
> >> >>
> >> >> On 3/13/09, ankit jain  wrote:
> >> >> > Hi all,
> >> >> >
> >> >> > I have a shell script. I want to link it with a library that i have
> >> >> > build
> >> >> > using cmake. Is it possible to do so.
> >> >> > I am running this shell script using cmake.
> >> >>
> >> >> You need to describe what you want to do in much more detail. What
> >> >> kind of link are you talking about? The first interpretation I made
> >> >> was that you are using a linker to link a library and a shell script
> >> >> into . Is it that you
> >> >> * want to call the linker from the script?
> >> >> * linking them in the context of packaging so they get installed
> >> >> together?
> >> >> * 
> >> >>
> >> >> Perhaps you could take a look at
> >> >>  http://www.catb.org/~esr/faqs/smart-questions.html
> >> >> so that we(I or any real cmake expert) can at least have a chance of
> >> >> helping you without wild guesses.
> >> >>
> >> >> Mattias
> >> >>
> >> >
> >> >
> >> >>  Iam sorry that i am not able to explain you properly.
> >> >>
> >> > Actually in my shl scripts there are certains commadns that i use.
> >> > these
> >> > commands are nothing but executbale which require some arguments.
> these
> >> > executables are actaully created by cmake. Also certain commands can
> >> > only
> >> > be
> >> > run from some libraries which are build by cmake.
> >> >
> >> > I am actually getting errors while running that shell script.
> >> > Error are like:  not found.
> >> > It is because iam not able to link that shell script or say not able
> to
> >> > include that library into the shell script. I dotn know how to link a
> >> > library with shell script so that while executing it gets all the
> supor
> >> tof
> >> > the library which it requires.
> >> >
> >> > As you have asked about linker  not explicitly iam passing anything to
> >> > linker calling linker from shell script.
> >> >
> >> > My need is to simple run the shell script which need a support of a
> >> > library.
> >> > Toa chieve it how to link thast library to shell script i dont know.
> It
> >> > might be like you said calling linker from shell script. i dontknow
> how
> >> it
> >> > can be achieved.
> >> >
> >> > You tell me in general sense if this the senario how to do it.
> >> >
> >> > I hope i make problem somewhat clear to you.
> >> >
> >> > Ankit
> >> >
> >> >>
> >> >> >
> >> >> > If possible plz let me show an example.
> >> >> >
> >> >> >
> >> >> > Ankit
> >> >> >
> >> >>
> >> >
> >>
> >
>
___
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] Cmake support to Java files

2009-03-19 Thread ankit jain
Hi all,

I have some java files. i want to build those so that ther equivalent class
files will be generated. Aprt from that i want to install .jar and .xsd
files. i dont know how cmake deal with java as i read that cmake does not
fully support java.

can anybody tell me how to do it by giving one example to me.

Regards-
Ankit Jain
___
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] Building java files from cmake

2009-03-19 Thread ankit jain
Hi all,

I have a folder "mainfolder" with sufolder "innerfolder" which has soem java
files. i want to create it class files. for that iam using add_sutom_command
to run the javac command but still my class files are not generated.

The content of cmakelist of mainfolder is:
project(mainfolder)
cmake_minimum_required(VERSION 2.4.0)
add_subdirectory(innerfolder)

 The content of cmakelist of innerfolder is:

set(
JAVADIST /myjava/jdk/1.4.2/Linux/
XERCESDIR /myjava/XML4J/4.3.4
 )
include_directories(${JAVADIST} ${XERCESDIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(JAVADIR $(JAVADIST)/bin)
set(
JAVAJRE $(JAVADIST)/jre
JAVAC $(JAVADIR)/javac
JAVA $(JAVADIR)/java
)
set(CLASSPATH
$(CMAKE_CURRENT_SOURCE_DIR):$(XERCESDIR)/xmlParserAPIs.jar:$(XERCESDIR)/xercesImpl.jar)
set(innerfolder_srcs
Myprogram.java
)
ADD_CUSTOM_COMMAND(OUTPUT  ${innerfolder_srcs}
   COMMAND ${JAVAC} ARGS -classpath ${CLASSPATH}
${innerfolder_srcs}
)


I dont know where iam doing something wrongdue to which class files for the
specifed source java file is not genrated..

Please guide me..

Ankit
___
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] Building java files from cmake

2009-03-20 Thread ankit jain
2009/3/20 Mattias Helsing 

> Hi Ankit,
>
> The set command doesn't work like you think.
> set(X a b c) creates a list called X with contents a;b;c. So you have the
> list
> JAVADIST with contents
> (/myjava/jdk/1.4.2/Linux/;XERCESDIR;/myjava/XML4J/4.3.4)
>
> try
> set(JAVADIST /myjava/jdk/1.4.2/Linux/ )
> set(XERCESDIR /myjava/XML4J/4.3.4 )
>

Still it does not work means not creating class files. No errors are
generated but .class files are not genrated.
I feel there might be a problem with CLASSPATH,
But also i try by explicitly set them. It doesnt work.

Check this link:
http://www.mail-archive.com/cmake@cmake.org/msg16764.html

Iam not getting whatever given in this link. How to use it i dont know.
Ankit

>
> Mattias
>
>
> On 3/20/09, ankit jain  wrote:
> > Hi all,
> >
> > I have a folder "mainfolder" with sufolder "innerfolder" which has soem
> java
> > files. i want to create it class files. for that iam using
> add_sutom_command
> > to run the javac command but still my class files are not generated.
> >
> > The content of cmakelist of mainfolder is:
> > project(mainfolder)
> > cmake_minimum_required(VERSION 2.4.0)
> > add_subdirectory(innerfolder)
> >
> >  The content of cmakelist of innerfolder is:
> >
> > set(
> > JAVADIST /myjava/jdk/1.4.2/Linux/
> > XERCESDIR /myjava/XML4J/4.3.4
> >  )
> > include_directories(${JAVADIST} ${XERCESDIR})
> > include_directories(${CMAKE_CURRENT_SOURCE_DIR})
> > set(JAVADIR $(JAVADIST)/bin)
> > set(
> > JAVAJRE $(JAVADIST)/jre
> > JAVAC $(JAVADIR)/javac
> > JAVA $(JAVADIR)/java
> > )
> > set(CLASSPATH
> >
> $(CMAKE_CURRENT_SOURCE_DIR):$(XERCESDIR)/xmlParserAPIs.jar:$(XERCESDIR)/xercesImpl.jar)
> > set(innerfolder_srcs
> > Myprogram.java
> > )
> > ADD_CUSTOM_COMMAND(OUTPUT  ${innerfolder_srcs}
> >COMMAND ${JAVAC} ARGS -classpath ${CLASSPATH}
> > ${innerfolder_srcs}
> > )
> >
> >
> > I dont know where iam doing something wrongdue to which class files for
> the
> > specifed source java file is not genrated..
> >
> > Please guide me..
> >
> > Ankit
> >
>
___
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] Docs for building java files through cmake

2009-03-20 Thread ankit jain
Hi all,

Can anybody tellme where i can find cmake docs that describe about various
command and other things for building the java files. it seems that for java
compiler flags and other command are diff. as we have for c and cpp files. i
wan tcomplete inf. related to it.


Ankit
___
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] Building java files from cmake

2009-03-20 Thread ankit jain
2009/3/20 Mattias Helsing 

> Hi Ankit,
>
> I have no xp with cmake for java. I was just pointing out my first
> immediate reaction to your script code.
>
> Perhaps you should try things in smaller scale, e.g. try to create a
> custom_command that compiles one java file. Also - during development
> I often use the message command (printf debugging), i.e.
> message("MYVAR ${MYVAR}")
>
> cheers
>  Mattias
>
> No problem. Thanks anyways  for the support
>

Ankit

>
> On 3/20/09, ankit jain  wrote:
> > 2009/3/20 Mattias Helsing 
> >
> >> Hi Ankit,
> >>
> >> The set command doesn't work like you think.
> >> set(X a b c) creates a list called X with contents a;b;c. So you have
> the
> >> list
> >> JAVADIST with contents
> >> (/myjava/jdk/1.4.2/Linux/;XERCESDIR;/myjava/XML4J/4.3.4)
> >>
> >> try
> >> set(JAVADIST /myjava/jdk/1.4.2/Linux/ )
> >> set(XERCESDIR /myjava/XML4J/4.3.4 )
> >>
> >
> > Still it does not work means not creating class files. No errors are
> > generated but .class files are not genrated.
> > I feel there might be a problem with CLASSPATH,
> > But also i try by explicitly set them. It doesnt work.
> >
> > Check this link:
> > http://www.mail-archive.com/cmake@cmake.org/msg16764.html
> >
> > Iam not getting whatever given in this link. How to use it i dont know.
> > Ankit
> >
> >>
> >> Mattias
> >>
> >>
> >> On 3/20/09, ankit jain  wrote:
> >> > Hi all,
> >> >
> >> > I have a folder "mainfolder" with sufolder "innerfolder" which has
> soem
> >> java
> >> > files. i want to create it class files. for that iam using
> >> add_sutom_command
> >> > to run the javac command but still my class files are not generated.
> >> >
> >> > The content of cmakelist of mainfolder is:
> >> > project(mainfolder)
> >> > cmake_minimum_required(VERSION 2.4.0)
> >> > add_subdirectory(innerfolder)
> >> >
> >> >  The content of cmakelist of innerfolder is:
> >> >
> >> > set(
> >> > JAVADIST /myjava/jdk/1.4.2/Linux/
> >> > XERCESDIR /myjava/XML4J/4.3.4
> >> >  )
> >> > include_directories(${JAVADIST} ${XERCESDIR})
> >> > include_directories(${CMAKE_CURRENT_SOURCE_DIR})
> >> > set(JAVADIR $(JAVADIST)/bin)
> >> > set(
> >> > JAVAJRE $(JAVADIST)/jre
> >> > JAVAC $(JAVADIR)/javac
> >> > JAVA $(JAVADIR)/java
> >> > )
> >> > set(CLASSPATH
> >> >
> >>
> $(CMAKE_CURRENT_SOURCE_DIR):$(XERCESDIR)/xmlParserAPIs.jar:$(XERCESDIR)/xercesImpl.jar)
> >> > set(innerfolder_srcs
> >> > Myprogram.java
> >> > )
> >> > ADD_CUSTOM_COMMAND(OUTPUT  ${innerfolder_srcs}
> >> >COMMAND ${JAVAC} ARGS -classpath ${CLASSPATH}
> >> > ${innerfolder_srcs}
> >> > )
> >> >
> >> >
> >> > I dont know where iam doing something wrongdue to which class files
> for
> >> the
> >> > specifed source java file is not genrated..
> >> >
> >> > Please guide me..
> >> >
> >> > Ankit
> >> >
> >>
> >
>
___
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 link jar files to a library through cmake

2009-03-20 Thread ankit jain
Hi all,

I am creating a library through add_library command of java files.
Now i want to link it with some jar files which contain some classes which
is needed to build that library.

target_link_libraries is not working in this case.


How to do it?..

Ankit
___
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 link jar files to a library through cmake

2009-03-20 Thread ankit jain
2009/3/20 Andreas Pokorny 

> Hello,
>
> 2009/3/20 ankit jain :
>  > Hi all,
> >
> > I am creating a library through add_library command of java files.
> > Now i want to link it with some jar files which contain some classes
> which
> > is needed to build that library.
> >
> > target_link_libraries is not working in this case.
>
> What do you mean by link?
> For java it should be sufficient to add the jar files to the class
> path. You can do that
> with the INCLUDE_DIRECTORIES command.
>
> kind regards
> Andreas
>

Can we set the classpath from cmake. Actually through include directories it
is not taking. i have to extract the fiels from the jar and then the library
is build otherwise simply including the jar files using include_directories
not working.

Iam not sure abotu classpath since it is not being set through cmakelist and
even when i set it through bash it is not taking those jar files.

Can u tell me how to do that with an example.

Thanks..

Ankit
___
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 link jar files to a library through cmake

2009-03-23 Thread ankit jain
2009/3/20 Robert Haines 

>  I am creating a library through add_library command of java files.
>> Now i want to link it with some jar files which contain some classes which
>> is needed to build that library.
>>
>> target_link_libraries is not working in this case.
>>
>
> As far as I can tell you need to set classpath via include_directories:
>
> include_directories(/path/to/classes /path/to/jars/jar.jar)
>
> See also this bug (including the attached file) for more details:
> http://public.kitware.com/Bug/view.php?id=7832
>
> Java support is pretty weak in CMake at present. It can be forced to
> behave, just, but it's not pleasant. Otherwise, CMake is a great tool!
>
> Cheers,
> Rob
>
>
As you have said i included the jars by include_directories command but it
is still not working because it does not find classes from which these jars
have build.

if i extract the classes from jar and include that folder path then it
works.

But my question is why it is not directly taking it when i give it the path
to jars why i need to extract the files from the jars abnd give its path..
if i extract the classes then what is the need to give path to that jar...

ankit
___
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] problem with add_custom command

2009-03-23 Thread ankit jain
hi all,

Iam doing the following through my cmakelist.txt

add_custom_target(mytarget)
add_custom_command(TARGET mytarget POST_BUILD
COMMAND ${CMAKE_COMMAND} -E tar xvf ${CMAKE_CURRENT_SOURCE_DIR}/t1.tar)
this cmakelist is written in subfolder of a mainfolder..

But the problem is that files are not extracted and it is not showing any
error.

Is iam doing something wrong..


Same problem with other where iam extracting jar files
add_custm_target(mytarget1)

add_custom_command(TARGET mytarget1 POST_BUILD
COMMAND jar ARGS -xf $(XERCESDIR)/xmlParserAPIs.jar
WORKING_DIRECTORY ${XERCESDIR})

here i want to extract the files in the smae directory whrer the jar exists.

is iam doing something wrong here too..

add_custom_command with output option doesnot seems to work thats why i go
with this approach

ANy suggestion in this regards will be of great help to me...


ankit


Ankit
___
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] problem with add_custom command

2009-03-24 Thread ankit jain
2009/3/25 Alexander Neundorf 

> On Tuesday 24 March 2009, ankit jain wrote:
> > hi all,
> >
> > Iam doing the following through my cmakelist.txt
> >
> > add_custom_target(mytarget)
> > add_custom_command(TARGET mytarget POST_BUILD
> > COMMAND ${CMAKE_COMMAND} -E tar xvf ${CMAKE_CURRENT_SOURCE_DIR}/t1.tar)
> > this cmakelist is written in subfolder of a mainfolder..
> >
> > But the problem is that files are not extracted and it is not showing any
> > error.
>
> Hm, I never tried to use add_custom_command(TARGET ... ) with a custom
> target.
> So if you do "make mytarget" then tar is not executed ?
> Did you try to do this directly using add_custom_target(), i.e. put the
> tar-command in the add_custom_target() ?
>
> Alex


I followed this approach becoz add_cutom_command with outptu option deos not
seems to work but actually i want to do it by that way only because from the
main tree i issue make only so thats why that target will not build.

Do anyone know what is the problem if i do like this and then run make:

add_custom_command(OUTPUT {TARDIR}/t2 {TARDIR}/t3
{TARDIR}/t1
COMMAND tar ARGS -xvf $(TARDIR)/mytar.tar
WORKING_DIRECTORY ${TARDIR})


> Here i want to extract the files in the same folder where tar exists..

the extraction will actually should give these t1, t2, t3 folder which i
mention in output ..

Is iam doing something wrong

Ankit


>
> ___
> 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] problem with add_custom command

2009-03-25 Thread ankit jain
2009/3/25 Michael Wild 

>
> On 25. Mar, 2009, at 7:51, ankit jain wrote:
>
> 2009/3/25 Alexander Neundorf 
>>
>> On Tuesday 24 March 2009, ankit jain wrote:
>>>
>>>> hi all,
>>>>
>>>> Iam doing the following through my cmakelist.txt
>>>>
>>>> add_custom_target(mytarget)
>>>> add_custom_command(TARGET mytarget POST_BUILD
>>>> COMMAND ${CMAKE_COMMAND} -E tar xvf ${CMAKE_CURRENT_SOURCE_DIR}/t1.tar)
>>>> this cmakelist is written in subfolder of a mainfolder..
>>>>
>>>> But the problem is that files are not extracted and it is not showing
>>>> any
>>>> error.
>>>>
>>>
>>> Hm, I never tried to use add_custom_command(TARGET ... ) with a custom
>>> target.
>>> So if you do "make mytarget" then tar is not executed ?
>>> Did you try to do this directly using add_custom_target(), i.e. put the
>>> tar-command in the add_custom_target() ?
>>>
>>> Alex
>>>
>>
>>
>> I followed this approach becoz add_cutom_command with outptu option deos
>> not
>> seems to work but actually i want to do it by that way only because from
>> the
>> main tree i issue make only so thats why that target will not build.
>>
>> Do anyone know what is the problem if i do like this and then run make:
>>
>> add_custom_command(OUTPUT {TARDIR}/t2 {TARDIR}/t3
>> {TARDIR}/t1
>> COMMAND tar ARGS -xvf $(TARDIR)/mytar.tar
>>
>
> -^--^
> those should probably be { and } instead of ( and )...
>
>
>> WORKING_DIRECTORY ${TARDIR})
>>
>>
>> Here i want to extract the files in the same folder where tar exists..
>>>
>>
>> the extraction will actually should give these t1, t2, t3 folder which i
>> mention in output ..
>>
>> Is iam doing something wrong
>>
>> Ankit
>>
>>
>>
>
> What I usually do is this:
>
> add_custom_command( OUTPUT ${TARDIR}/t1
>  COMMAND ${CMAKE_COMMAND} -E tar xvf ${TARDIR}/mytar.tar
>  WORKING_DIRECTORY ${TARDIR}
>  COMMENT "Extracting ${TARDIR}/mytar.tar"
>  VERBATIM
>  )
>
> add_custom_target( extract_mytar
>  DEPENDS ${TARDIR}/t1
>  )
>
> This tells CMake how to obtain the file ${TARDIR}/t1 by unpacking
> mytar.tar. Then it adds a target which depends on that file. You then can
> have other targets depend on that by using add_dependencies.
>


Thanks for your suggestions it works but the problem is that iam making a
library which requires some source files which will come after extracting it
from tar.

In that making an custom target for it and then add_dependencies to that
library to this custom build target does not solve the purpose.

then how to include those files which is required by the library which came
from tar.


Ankit

>
> Another thing: Please make sure that TARDIR is in the build tree (i.e.
> somewhere below CMAKE_BINARY_DIR). Extracting tar-balls in the source tree
> is a pretty bad idea.
>
> 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] problem with add_custom command

2009-03-25 Thread ankit jain
2009/3/25 Michael Wild 

>
> On 25. Mar, 2009, at 9:33, ankit jain wrote:
>
> 2009/3/25 Michael Wild 
>>
>
> [...]
>
>
>>> What I usually do is this:
>>>
>>> add_custom_command( OUTPUT ${TARDIR}/t1
>>> COMMAND ${CMAKE_COMMAND} -E tar xvf ${TARDIR}/mytar.tar
>>> WORKING_DIRECTORY ${TARDIR}
>>> COMMENT "Extracting ${TARDIR}/mytar.tar"
>>> VERBATIM
>>> )
>>>
>>> add_custom_target( extract_mytar
>>> DEPENDS ${TARDIR}/t1
>>> )
>>>
>>> This tells CMake how to obtain the file ${TARDIR}/t1 by unpacking
>>> mytar.tar. Then it adds a target which depends on that file. You then can
>>> have other targets depend on that by using add_dependencies.
>>>
>>>
>>
>> Thanks for your suggestions it works but the problem is that iam making a
>> library which requires some source files which will come after extracting
>> it
>> from tar.
>>
>> In that making an custom target for it and then add_dependencies to that
>> library to this custom build target does not solve the purpose.
>>
>> then how to include those files which is required by the library which
>> came
>> from tar.
>>
>
>
> if you add all the files from the tar archive to the OUTPUT list of
> add_custom_command, CMake should automatically set the GENERATED property of
> those file to TRUE. If you don't want to do that, you still can set that
> property manually, using e.g.:
>
> set_source_files_properties( ${TARDIR}/t1 ${TARDIR}/t2 PROPERTIES GENERATED
> TRUE )
>
> you then can use those files in a normal add_library or add_executable
> command. if you use the first approach (listing all files in the OUTPUT
> list), you don't even need the custom target, since CMake then will know how
> to "create" these files (by invoking the custom command).
>
>
Is there any way by which we just give the name of folder where files has
extracted and add_library command will take it by some means it is becoz if
we dont know what files will be genrated inside that folder or if there are
large no.of files then listing them in OUTPUT is really cumbersome..


ankit

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

[CMake] Why jars not linked to other files directly in cmake

2009-03-25 Thread ankit jain
Hi all,,

I have seen that only including the directories where jars exist wil not
solve the puprose of using those jars. we have to either extract the files
from it or either include the directories where the file exists from which
jars have been made.

If we give that path then what is the need of jars

i try to link the jars but its not working . i extract the files and then
include them then its working...

if somebody works with jars and able to achieve this whatever i have said
please let me know..

ankit
___
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] Why jars not linked to other files directly in cmake

2009-03-25 Thread ankit jain
2009/3/25 Robert Haines 

>  I have seen that only including the directories where jars exist wil not
>> solve the puprose of using those jars. we have to either extract the files
>> from it or either include the directories where the file exists from which
>> jars have been made.
>>
>
> Have you actually tried including the jars themselves? eg
> include_directories(/path/to/jar/mylib.jar) This works fine for me and is
> consistent with how you must list jars in CLASSPATH. Admittedly, using
> include_directories for this feels a bit clunky, but it does work...
>
> Cheers,
> Rob
>

Thanks Rob i checked it again it works now for me actually i run make from
root directory and iam creating a library with some java files listed in my
cmakelist as src but when runnng it from root i need to write
include_directories(${CMAKE_CURRENT_SOURCE_DIR} in sub dir. cmakelist file.
earlier i thought it is not taking jars but actually jars are working fine
and it is not taking files from the sub diretory itselg ..

Generally if we include all files in cmkelist then there is no need to write
above line but mihgt require in java case.

but anyways it works now. thanks for the help..

ankit

>
> --
> Robert Haines
>
> Research Associate, RealityGrid  Tel. : +44 (0)161 275 6067
> Research Computing Services  Fax. : +44 (0)161 275 0637
> University of Manchester Email: rhai...@manchester.ac.uk
> Oxford Road  Web  : www.realitygrid.org
> Manchester, M13 9PL   : www.rcs.manchester.ac.uk
>
>
___
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] Argument passing to shell script through cmake

2009-03-25 Thread ankit jain
Hi all,

I want to run one shell script which requires some arguments to pass in
cmakelists file.
Simply using install command to run it does not allow to pass arguments to
it.

How to do it 

ankit
___
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 set options if we have mixture of languages in our project

2009-03-26 Thread ankit jain
Hi all,

my project contain c cpp and java files. I have used this line in my main
CMakelists file
add_definitions(-Wno-deprecated)

But when it comes to java folder where java files are there it creates
problem said unreconized option with javac.

Can i do something for it. Acc. to me if stmt will work but what should be
given inside if as a stmt to check for a language so that it works i dont
know...

Ankit
___
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] Argument passing to shell script through cmake

2009-03-26 Thread ankit jain
2009/3/25 Denis Scherbakov 

>
> Did you try EXECUTE_PROCESS and ADD_CUSTOM_COMMAND?
>
> Denis
>

I tried execute process it works but hte problem is that it runs at compile
time itself i want that script wil run at build time.

With add_custom_command iam not able to give something in OUTPUT since the
script simply display a message.

Another problem is that  with other add_custom_command wher iam specify
OUTPUT which is something like files then its compulsory to link them with
some target but i simply want to generate it. also unless an until u cant
link to some target and run "make  add_custom_command willnot
run.

I want to simply run the make command and want to execute teh command but
this OUTPUT as well as linking it with some target really creates a lots of
problem to me..

Is there any way by which if want to simply executes a command it runs on
doing "make" only. add _custom _commadn demands OUTPUT which is not a
problem but the tresult will not come unless u link it with some target and
then built that target for that u have to give "make . i just
want to run make...

I hope i make clear my problem...
Let me know how to get rid of it...

Ankit

>
>
> --- On Wed, 3/25/09, ankit jain  wrote:
>
> > From: ankit jain 
> > Subject: [CMake] Argument passing to shell script through cmake
> > To: cmake@cmake.org
> > Date: Wednesday, March 25, 2009, 5:54 AM
>  > Hi all,
> >
> > I want to run one shell script which requires some
> > arguments to pass in
> > cmakelists file.
> > Simply using install command to run it does not allow to
> > pass arguments to
> > it.
> >
> > How to do it 
> >
> > ankit
> > ___
> > 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

[CMake] wanna execute a command on make clean through cmakelists

2009-04-07 Thread ankit jain
Hi all,

I want to remove certain files when i do make clean.These files are
generated while running tests.
how to achieve it..
if i dont do that the files which once generated remains there...
on make clean only object files will remove automatically nothing is needed
to do from our side.
but apart from that if we want to remove anything while doing make clean how
to do i dont know..

Guide me with an example..

Ankit
___
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] cmake hp-ux binary creates .sl libraries rather than .so libraries.

2009-04-28 Thread ankit jain
Hi all,

I am building my code on hp-ux itanium 64 bit. but the cmake binaries that
are available for hp-ux are for PA_RISC due to which when iam building my
code the shared libraries got .sl extension rather than .so.

Please let me know if binaries for itanium is there or not or with te same
PA_RISC cmake binaries how to get .so extension for my shared libraries

Regards-
ankit jain
___
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 hp-ux binary creates .sl libraries rather than .so libraries.

2009-04-28 Thread ankit jain
2009/4/28 Bill Hoffman 

> Denis Scherbakov wrote:
>
>> HP-UX on PA-RISC uses *.sl or no extension (like libC.2 for PA-RISC 2.0)
>> HP-UX on IA64 uses *.so naming like in Linux.
>>
>>
> http://www.mainsoft.com/solutions/windows_to_hpipf.aspx
>
> "> Shared library naming convention
>
>>
>> The shared library naming convention on Itanium 2 is different than
>> that of PA-RISC. On PA-RISC, general names for libraries, libxxx.sl,
>> are used, whereas on Itanium 2, the libraries are named libxxx.so.
>> This will affect both build systems and all code that loads shared
>> libraries at runtime (e.g. calls to dlopen() or shl_load() ). This
>> might also affect other production scripts.
>>
>
>   As you told Bill it is correct about the library extension but when I
build the code on itanium ia64 on hp machine cmake by default generates .sl
extension for shared libraries. i think it does so because the cmake binary
that is available for hp-ux is for PA-RISC not for itanium.

for the time being i get the .so extension for shared library by setting
CMAKE_SHARED_LIBRARY_SUFFIX variable.

But i think either cmake itself identify the hp architecture as ia64 or
PA-RISC and then build the shared library with proper extension or we should
have different cmake binaries for itanium and PA_RISC..


ankit


> The change will have to go in Modules/Platform/HP-UX.cmake.   I think we
> should be able to check the CMAKE_HOST_SYSTEM_PROCESSOR variable.   If
> someone has access to one of these machines and can work out a patch, I can
> put it in CMake.  Even better, if someone has access to one of these
> machines, and can setup a nightly dashboard to make sure it stays working.
>
>
>
> -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

[CMake] Cmake support for MKS toolkit

2009-04-30 Thread ankit jain
Hi all,
I am working on windows. I am currently using MKS to build my code without
using cmake. but since i dont know whether cmake supports MKS or not iam not
able to build my code through cmake using mks. If yes, please can anybody
let me know how i can build my code through mks toolkit on windows using
cmake. since i dont find as such binaries for mks toolkit specially.

I need to do this because if i dont use mks and build code directly using
cmake binaries for windows then all the unix functions are not working on
windows. i got error of unistd.h not exists and platform not  recognised
since i define macro for windows as NUTC for mks..

So please guide how to proceed..
Any help in this regard really helps me a lot...


Regards-
Ankit Jain
___
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] Changing the default compiler of VC++

2009-05-04 Thread ankit jain
Hi all,

Actually I am porting my code on windows but since windows don't understand
the unix libraries iam using third party toolkit mks earlier to build the
code and linking all the headers and libraries of mksnt.

but now i am not using mks and directly building the code using visual
studio .net 2003. since VC++ uses cl compiler by defualt i want to change it
through cmakelist variable CMAKE_C_COMPILER and CXX variable to the compiler
used by mks i.e cxx.

But when iam doing so it is still using cl. I am not getting from where it
is taking cl complier and not changing to whatever i want.

It might feel auckward to some of you that why iam changing to mks compiler
becuase  iwant to check my code whether without opening mks bash if iam
direclty using its compiler will it work or not..

I request you all to tell me how it can de done so that my VC++ takes cxx
compiler of mks toolkit rather its default cl compiler...
why changing cmake variable doesnot have any effect on it that i mentioned
above for compiler...


Regards-
Ankit Jain
___
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] Changing the default compiler of VC++

2009-05-04 Thread ankit jain
2009/5/4 Andreas Pakulat 

> On 04.05.09 17:28:48, ankit jain wrote:
> > Hi all,
> >
> > Actually I am porting my code on windows but since windows don't
> understand
> > the unix libraries iam using third party toolkit mks earlier to build the
> > code and linking all the headers and libraries of mksnt.
> >
> > but now i am not using mks and directly building the code using visual
> > studio .net 2003. since VC++ uses cl compiler by defualt i want to change
> it
> > through cmakelist variable CMAKE_C_COMPILER and CXX variable to the
> compiler
> > used by mks i.e cxx.
> >
> > But when iam doing so it is still using cl. I am not getting from where
> it
> > is taking cl complier and not changing to whatever i want.
> >
> > It might feel auckward to some of you that why iam changing to mks
> compiler
> > becuase  iwant to check my code whether without opening mks bash if iam
> > direclty using its compiler will it work or not..
> >
> > I request you all to tell me how it can de done so that my VC++ takes cxx
> > compiler of mks toolkit rather its default cl compiler...
>
> I think you can't or I'm misunderstanding what you really want to do. VC++
> _always_ uses cl as VC++ == cl+link basically. You might be able to get
> cmake to use the mks compiler by providing an environment in which cl is
> not available in PATH but the mks compiler.
>
> However its not quite clear wether you're already doing that (build your
> code with mks) and now want to build the same code with cl/VC++ or
> something else?
>

Thanks Andreas for your reply. I already build the code using mks. now i
want to build the code using cl/VC++. since it gives lots of errors of not
founding fiels like strings.h unistd.h so i thought its good to link it with
mks compiler and give path to the libraries and header used my mks for
windows.. i hope you got it..

Ankit

>
> Andreas
>
> --
> You love your home and want it to be beautiful.
> ___
> 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

[CMake] CMake, MKS and VC++

2009-05-05 Thread ankit jain
Hi all,

I build me code without cmake through mks on windows... it is successful..
Now i want to build my code through cmake on mks for windows. The project is
compiling but like other OS's it is not generating Makefile so on doing make
it says error: Make no target...

So guide me how to proceed..

I also tried with VC++ directly to build the code but it seems to give lots
of error since i feel it have problem with nutcracker which i used in code
for windows and also i think not able to link some DLL but not sure since on
mks i compile with one definition as -D__NUTC_DLL__ ... It is because VC++
uses cl compiler not cxx compiler of mks..

This is what i think but iam not sure of anything...

You people guide the right way that helps me in building the code using
cmake with mks through VC++...
Also if any settings are required for VC++ tell me so that i configure that
acc.
I struggled a lot with VC++ for building code thorugh cmake.
 My code is configured properly but on running it gives lots of error...

 Any help in this regard really helps me a lot..

Regards-
Ankit Jain
___
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, MKS and VC++

2009-05-06 Thread ankit jain
2009/5/7 Philip Lowman 

> You probably are missing some build flags or libraries in the CMakeLists
> that are in the old build system.  Try comparing the VC projects generated
> by CMake and looking at the compile & link lines vs. your other build
> system.  You'll inevitably find a difference between the two if you're using
> the same compiler and dependencies.
>

Problem here is that iam using VC++ compiler cl and there in old build
system they use MKS toolkit cxx compiler.. and i dont know how can i use cxx
compiler from VC++.
and i think it cant be done..

ankit

>
>
> On Tue, May 5, 2009 at 8:29 AM, ankit jain  wrote:
>
>> Hi all,
>>
>> I build me code without cmake through mks on windows... it is successful..
>> Now i want to build my code through cmake on mks for windows. The project
>> is compiling but like other OS's it is not generating Makefile so on doing
>> make it says error: Make no target...
>>
>> So guide me how to proceed..
>>
>> I also tried with VC++ directly to build the code but it seems to give
>> lots of error since i feel it have problem with nutcracker which i used in
>> code for windows and also i think not able to link some DLL but not sure
>> since on mks i compile with one definition as -D__NUTC_DLL__ ... It is
>> because VC++ uses cl compiler not cxx compiler of mks..
>>
>> This is what i think but iam not sure of anything...
>>
>> You people guide the right way that helps me in building the code using
>> cmake with mks through VC++...
>> Also if any settings are required for VC++ tell me so that i configure
>> that acc.
>> I struggled a lot with VC++ for building code thorugh cmake.
>>  My code is configured properly but on running it gives lots of error...
>>
>>  Any help in this regard really helps me a lot..
>>
>> Regards-
>> Ankit Jain
>>
>> ___
>> 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

[CMake] Settings different compile options for diff. files in same folder..

2009-05-14 Thread ankit jain
Hi all,

I have a folder in which there are 5 files
folder
  a1.c
  a2.c
  a3.c
  a4.c
  a5.c

Out of these from 4th and 5th iam making a library if iam working on windows
else with the rest three iam building one library for the folder.
Even on windows also iam making this library but making one more library for
the files 4th and 5th.,.

Problem:::

Now the problem is that for the first three files i set certain macros and
certain CXX compile flags.
But for the 4th and 5th files i need not want these settings..
I want no macros and only two diff. compile flags /clr and /MD for compiling
these files and certain things for linking like /STCAK:value /NOENTRY
/NODEFUALTLIB:value

But when i am settings these using the set_source_files_properties the older
properties also exists there. they are not removed..

I dont understand how to remove old one and set new settings for these files
only,

Remember iam working on windows.(Visual studio .NET 2003)
when iam setting /clr  /RTC will not be there but since it is set earlier it
is not removed i dont know why...

One more problem is there that is set the properties of files through the
set_source_files_properties and suppose i want to set two flags while
compiling like this:

set_source _files_properties(${source} PROPERTIES COMPILE_FLAGS /clr;/MD)

it does not taking it.. only one flag iam able to set not multiple flags..

One example if you give will give me great help..
Can anybody let me know how to do all these...
If any clarification required please let me know..

Regards-
ankit jain
___
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] Settings different compile options for diff. files in same folder

2009-05-14 Thread ankit jain
-- Forwarded message --
From: ankit jain 
Date: 2009/5/14
Subject: Settings different compile options for diff. files in same folder..
To: cmake@cmake.org


Hi all,

I have a folder in which there are 5 files
folder
  a1.c
  a2.c
  a3.c
  a4.c
  a5.c

Out of these from 4th and 5th iam making a library if iam working on windows
else with the rest three iam building one library for the folder.
Even on windows also iam making this library but making one more library for
the files 4th and 5th.,.

Problem:::

Now the problem is that for the first three files i set certain macros and
certain CXX compile flags.
But for the 4th and 5th files i need not want these settings..
I want no macros and only two diff. compile flags /clr and /MD for compiling
these files and certain things for linking like /STCAK:value /NOENTRY
/NODEFUALTLIB:value

But when i am settings these using the set_source_files_properties the older
properties also exists there. they are not removed..

I dont understand how to remove old one and set new settings for these files
only,

Remember iam working on windows.(Visual studio .NET 2003)
when iam setting /clr  /RTC will not be there but since it is set earlier it
is not removed i dont know why...


What i need to do is this::(do not want previous settings of compiler flags
and linkage)

cl /clr /MD -I../include/ -m  -c perfdata.C
cl /clr /MD -I../include/ -m  -c perfinit.C

these are my 4th and 5th file as i mentioned..

 link /NOENTRY msvcrt.lib mscoree.lib kernel32.lib /DLL /STACK:0xC0
/NODEFAULTLIB:nochkclr.obj
/INCLUDE:__dllmaincrtstar...@12/OUT:liborchperfdatant.dll perfdata.o
perfinit.o


One more problem is there that is set the properties of files through the
set_source_files_properties and suppose i want to set two flags while
compiling like this:

set_source _files_properties(${source} PROPERTIES COMPILE_FLAGS /clr;/MD)

it does not taking it.. only one flag iam able to set not multiple flags..

One example if you give will give me great help..
Can anybody let me know how to do all these...
If any clarification required please let me know..

Regards-
ankit jain
___
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] unable to include a source file for all sub directories

2009-05-14 Thread ankit jain
Hi all,

My problem is like this...
My source tree structure is:
Main_folder
.. Ident.c
..folder1
f11.c
f12.c
..folder2
..f21.c
..f22.c
..folder3
f31.c
f32.c

Now iam building a library for main_folder as:

foreach(fname ${folder1_srcs}
list(APPEND main_folder_srcs folder1/${fanme})
endforeach(fname)
foreach(fname ${folder2_srcs}
list(APPEND main_folder_srcs folder2/${fanme})
endforeach(fname)
foreach(fname ${folder3_srcs}
list(APPEND main_folder_srcs folder2/${fanme})
endforeach(fname)

list(APPEND main_folders_srcs Ident.c)
add_library(mylib SHARED ${main_folder_srcs})

Now I am able to get all the source files from all the folders. but the
problem is that all folder source files uses one variable v1 of this Ident.c
file..

So the error iam getting while building the library is :
unresolved external symbol: v1  (iam working on windows VC++)

I am not getting why the sub directories are not able tio extract that
variable v1 from the Ident.c file
Is my way of including the file is wrong..

Please tell what should i do so that the sudirectories files are able to
acccess that varaible v1 from file Ident.c which is outside it as mentioned
in above tree structure...


Regards-
Ankit Jain
___
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] unable to include a source file for all sub directories

2009-05-15 Thread ankit jain
-- Forwarded message --
From: ankit jain 
Date: 2009/5/15
Subject: Re: [CMake] unable to include a source file for all sub directories
To: Hendrik Sattler 




2009/5/15 Hendrik Sattler 

Zitat von ankit jain :
>
>> Now I am able to get all the source files from all the folders. but the
>> problem is that all folder source files uses one variable v1 of this
>> Ident.c
>> file..
>>
>> So the error iam getting while building the library is :
>> unresolved external symbol: v1  (iam working on windows VC++)
>>
>
> How exactly does this relate to CMake? As usual, you do not give enough
> information but it's clearly not a CMake issue.
> Guessing on compilers errors without context is boring and a waste of time.
>
> HS
>
Sorry if iam not able to state my problem clearly.
If suppose 5 files are there in  one folder and each file uses some
functions form other file in the same folder and when ur creating library
then there is no problem..

Issue is if one folder file uses another file which is in diff. folder or in
its parent folder then creating library creates problem and giving error as
unresolved symbols. since iam building through cmake and i used the already
said method of how iam adding sources for the libraries form the sub folders
i think my way of including files is somewhat wrong or iam missing somethign
duet o which those files are not able to take the support that file...

I hope i add some  clarification in this regard.


Ankit
___
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] unable to include a source file for all sub directories

2009-05-15 Thread ankit jain
-- Forwarded message --
From: ankit jain 
Date: 2009/5/15
Subject: Re: [CMake] unable to include a source file for all sub directories
To: Hendrik Sattler 




2009/5/15 Hendrik Sattler 

> Zitat von ankit jain :
>
>> If suppose 5 files are there in  one folder and each file uses some
>> functions form other file in the same folder and when ur creating library
>> then there is no problem..
>>
>> Issue is if one folder file uses another file which is in diff. folder or
>> in
>> its parent folder then creating library creates problem and giving error
>> as
>> unresolved symbols. since iam building through cmake and i used the
>> already
>> said method of how iam adding sources for the libraries form the sub
>> folders
>> i think my way of including files is somewhat wrong or iam missing
>> somethign
>> duet o which those files are not able to take the support that file...
>>
>
> The file positions do not matter to the compiler if they are all sources to
> the same library.
>
> 1.
> Is the list of files correct? Check with a message() in your
> CMakeLists.txt.
>

Yes

>
> 2.
> Are all files compile into object? Check the _verbose_ output.
>

Yes

>
> 3.
> Is that a compiler error or a linker error?
>

Linker error for many objects files that have created

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

Re: [CMake] unable to include a source file for all sub directories

2009-05-15 Thread ankit jain
2009/5/15 Hendrik Sattler 

> Zitat von ankit jain :
>
>> Linker error for many objects files that have created
>>
>
> So either the object file that contains the symbol is not part of your link
> command or you have a coding error.
> Since you release neither an example nor further information, you will
> probably not get any other answer.
>
> HS
>
Eg:

main
...Ident.c
folder1
...f11.c
...f12.c
...folder2
..f21.c
..f22.c

Now if this Ident.c is there in each folder1 and folder2 then it works
well.. but since it is outside folder1 and fodler2 so while linking neither
f11 f12 f21 f22 will be able to link Ident.c

iam making library main as:
...CMakeLists of main folder.

foreach(fname ${folder1_srcs})
list(APPEND main_srcs folder1/${fname})
endforeach(fname)

foreach(fname ${folder2_srcs})
list(APPEND main_srcs folder2/${fname})
endforeach(fname)

list(APPEND main_srcs Ident.c)
add_library(main SHARED ${main_srcs})


CMakelist of folder1...

set(folder1_srcs f11.c f12.c)
set(folder1_srcs ${folder1_srcs} PARENT_SCOPE)

CMakelist of folder2...

set(folder2_srcs f21.c f22.c)
set(folder2_srcs ${folder2_srcs} PARENT_SCOPE)

Now all files iam getting from folder1 and folder2 and objects of all files
including Ident.c is created... But while linking f11.obj f12.obj f21.obj
f22.obj all show error undefined symbol:
char *v1

where Ident .c contains..

char v1[]="Hello";


I this example give you idea what iam trying to do...

Ankit
___
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] unable to include a source file for all sub directories

2009-05-15 Thread ankit jain
-- Forwarded message --
From: ankit jain 
Date: 2009/5/15
Subject: Re: [CMake] unable to include a source file for all sub directories
To: Hendrik Sattler 




2009/5/15 Hendrik Sattler 

> Zitat von ankit jain :
>
>> Now all files iam getting from folder1 and folder2 and objects of all
>> files
>> including Ident.c is created... But while linking f11.obj f12.obj f21.obj
>> f22.obj all show error undefined symbol:
>> char *v1
>>
>> where Ident .c contains..
>>
>> char v1[]="Hello";
>>
>
> If you want a pointer, declare a pointer, not an array!
> If you would use a common header file that is also used in Indent.c(!), you
> would get something like (I don't have MSVC at hand but it's also a C++
> compiler):
> $ cat a.c
> extern char *v1;
> char v1[] = "Hallo";
>
> $ g++ -c -o a.o a.c
> a.c:3: error: conflicting types for `char v1[]'
> a.c:1: error: previous declaration as `char*v1'
>
> while:
> $ cat a.c
> extern char *v1;
> char *v1 = "Hallo";
>
> $ g++ -c -o a.o a.c
> 
>
> HS
>
> But if it is a pointer problem only then why ity works if i include the
same file in the subfolders which need that file.
Also i have tried this thing it doesnot make any difference in building with
VC++.
___
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] unable to include a source file for all sub directories

2009-05-15 Thread ankit jain
2009/5/15 

> ankit jain  wrote:
>
> > My source tree structure is:
> > Main_folder
> >.. Ident.c
> >..folder1
> >f11.c
> >f12.c
> > [...]
> >
> > Now I am able to get all the source files from all the folders. but
> the
> > problem is that all folder source files uses one variable v1 of this
> Ident.c
> > file..
> >
> > So the error iam getting while building the library is :
> > unresolved external symbol: v1  (iam working on windows VC++)
>
> I suggest the following exercise: use VC++ to create a very simple
> workspace/"solution" with just one VC++ "project" in it that builds a
> library.  Add Ident.c and just a few of your other files (maybe just
> f11.c) to this project.  Then try to build this project.
>
> Now either one of two things will happen:
>
> 1. You will get the same link errors as before.  Then you know your
> problem is that you have incorrect C++ code; CMake did not cause the
> problem and cannot solve it.  You might then try asking a C/C++ forum
> what is wrong, but before you do that you should delete as much code
> from Ident.c and f11.c as possible while making sure you still get the
> same error when you try to build the code.  Then you can post the
> complete contents of these files when asking your question.  (You will
> probably not get an answer if you don't post code, or if you post more
> than a couple of pages of code.  Many people are willing to help, but
> not if they have to do a lot of work that you could have done yourself.)
>
> 2. You will not get the same link errors.  Then you may be able to find
> some difference in the settings of the projects (between the project
> created by CMake and the one you created directly in VC++) that explains
> why there is an error only in the CMake project.
>
> I have a very strong hunch you will get the first result.
>
> David A. Karr
>

Thanks for the suggestion David but ht eproblem is still there. i will give
you the content of two files with the tree structure. i request you to do
the same for me on your machine and see whether it gives error or not..

mainfolder
...Ident.c
...subfolder
.file.c

Ident.c contain:

int number=10;
char array[]="hello";

subfolder/file.c contains:

#some header files
extern int number;
print("iam in sub folder");

Now cmakelists of mainfolder is:

Project (mainfolder)

foreach(fname ${subfolder_srcs})
list(APPEND mainfolder_srcs subfodler/${fname})
endforeach(fname)

list(APPEND mainfolder_srcs Ident.c)
add_library(mylib SHARED ${mainfolder_srcs})


CMakelist of subfolder..

set(subfolder _srcs file.c)
set(subfodler_srcs ${subfolder_srcs} PARENT_SCOPE)

Thats it..

Compiling is ok .. Ident.obj and file.obj created..
But when it creating mylib library in linking it says:
file.obj : unresolved external symbol: int number

if the tree structure is like this:
mainfolder
Ident.c
file.c

Means no subfolder direct file in mainfolder. then there is no problem in
creating the library.
Because of accessing file from subfolder it creates problem..

Also if in VC++ if i give addtional option in compilation as /FI"filepath to
Ident.c"
Then it works..
because file.c is compiled with Ident.c
so it works but i dont want to give this flag in compiler option...

Why it is not taking directly...

I hope i make my question very clear...

Regards-
Ankit Jain..




> ___
> 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] unable to include a source file for all sub directories

2009-05-18 Thread ankit jain
2009/5/16 Hendrik Sattler 

> Am Freitag 15 Mai 2009 17:05:58 schrieb ankit jain:
> [...]
>
> The following works with VS2008 without any problem as expected:
> CMakeLists.txt:
> --
> project(var C)
> add_executable(var sub/main.c var.c var.h)
> --
>
Just try this:
add_library(var sub/main.c var.c)

>
> var.c:
> --
> //  #include "var.h"(dont include this line since no var.h is there)
>
   #include

> char* var1 = "Hallo";
> --
>
> //var.h:
> --
> //extern char *var1;
> --
>
> sub/main.c
> --
> //  #include "../var.h"
> #include 

extern char *var1;

>
> int main (int argc, char **argv)
> {
>  printf(var1);
>  return 0;
> }
> --
>
> So the problem is _definitely_ with your code.
>

I made the changes above can u run this code for me and let me know whether
it is working or not.
i commented the line  which are not there in my code. Also here var.h is not
exits since code of var.h is directly there in main.c..

Ankit

>
> 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] Linking object file with executable

2009-05-19 Thread ankit jain
Hi all,

My Cmakelists contains:

set(myobj  ${CMAKE_CURRENT_SOURCE_DIR}/../objfolder/myfile.obj)
add_executable(myexe  main.c ${myobj})

This myfile.obj object file is generated while building objfolder before
creating this executable

Now on building this executable i got a warning:

main.obj: warning: earlier declaration of a function f1() found in
myfile.obj: second definition ignored..

This means it is taking the f1() function from myfile.obj but i want f1()
function to be taken from main.obj..

What to do?

Also it is imp. to link this myfile.obj file to myexe  executable since it
depends on other functions of this object file..
So this object file has to be there.
Just tell me how function f1() can be taken from main.c rahter than from
myfile.obj evenif it still gives warning as:

myfile.obj:warning: earlier definition of function f1() found in main.c
(since if it takes f1() from main.c): second def. ignored

Regards-
Ankit Jain
___
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] Linking object file with executable

2009-05-20 Thread ankit jain
2009/5/20 Dmytro Ovdiienko 

> Hi Ankit.
>
>
> Did you try TARGET_LINK_LIBRARIES?
>
> TARGET_LINK_LIBRARIES( myexe ${myobj} )


It gives error as myfile.obj.lib not found..
Since it is not library it is not valid to give like this...

Ankit


>
>
> 2009/5/19 ankit jain 
>
>> Hi all,
>>
>> My Cmakelists contains:
>>
>> set(myobj  ${CMAKE_CURRENT_SOURCE_DIR}/../objfolder/myfile.obj)
>> add_executable(myexe  main.c ${myobj})
>>
>> This myfile.obj object file is generated while building objfolder before
>> creating this executable
>>
>> Now on building this executable i got a warning:
>>
>> main.obj: warning: earlier declaration of a function f1() found in
>> myfile.obj: second definition ignored..
>>
>> This means it is taking the f1() function from myfile.obj but i want f1()
>> function to be taken from main.obj..
>>
>> What to do?
>>
>> Also it is imp. to link this myfile.obj file to myexe  executable since it
>> depends on other functions of this object file..
>> So this object file has to be there.
>> Just tell me how function f1() can be taken from main.c rahter than from
>> myfile.obj evenif it still gives warning as:
>>
>> myfile.obj:warning: earlier definition of function f1() found in main.c
>> (since if it takes f1() from main.c): second def. ignored
>>
>> Regards-
>> Ankit Jain
>>
>>
>>
>> ___
>> 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

[CMake] Want to compile a file but does not want to link it in library

2009-05-25 Thread ankit jain
Hi all,

I have a folder f1 having 4 files c1.c c2.c c3.c c4.c.
Now iam compiling all these files with certain definitions and other
compiler flags.

Now what i want is that when iam building library for this forder f1 it does
not take c4.c

One way is that i should not include this file in creating library.In that
case c4.c willnot be compiled but i want c4.c to compile but not be included
in the library.

Also if i use add_custom_command to compile that file explicitly then i have
to give all the definitions and other compiler option settings for that file
explicitly which i dont want to do..

Is there any option in cmake while creating library which allows compiling a
file but not linking it in library.

Regards-
Ankit Jain
___
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