Re: [CMake] How to find fortran library

2008-12-04 Thread Javier Gonzalez
Maik Beckmann wrote:
 Am Mittwoch, 3. Dezember 2008 schrieb Javier Gonzalez:
   
 Hi all,

 I have a project that links to another project built with Fortran. My
 own project is a C++ project and I usually need to link against a
 fortran library of some sort to use the first one. I use gcc, so it
 usually is libgfortran or libg2c.

 Now my question is: if I enable Fortran, will there be a variable that
 tells me the location of the library I need to link to?
 

 No.  The compiler frontend (gfortran, g77, ...) makes the decision which 
 system and compiler libraries have to be linked in.  

 If you or cmake link an fortran executable with 
   g77 -o myapp a.o b.o ..
 libg2c will be linked in by g77.  When doing
   g77 -o myapp a.o b.o ..
 libgfortran will be linked in by gfortran.

 The same is true for g++, which links in libstdc++ by default.

   
 What I do at the moment is that I guess which library I need to link to
 based on the Fortran compiler's name and, since I use gcc, try to find
 it in the path given by 'gcc -print-search-dirs'. Is this the right way?
 I would expect that cmake defines a variable with this information
 somewhere.
 

 This is the right way.  Maybe an effort to write cmake module which handles 
 this task is worthy.

 Best,
  -- Maik


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

   
I see.

Later I saw Bill's message about the new release. One of the changes in
2.6.3 RC5 is:
- Add FortranCInterface.cmake module to discover Fortran/C interfaces

I wonder if that is precisely what I was looking for so I will check it out.

thanks,
Javier
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


[CMake] How to find fortran library

2008-12-03 Thread Javier Gonzalez
Hi all,

I have a project that links to another project built with Fortran. My
own project is a C++ project and I usually need to link against a
fortran library of some sort to use the first one. I use gcc, so it
usually is libgfortran or libg2c.

Now my question is: if I enable Fortran, will there be a variable that
tells me the location of the library I need to link to?

What I do at the moment is that I guess which library I need to link to
based on the Fortran compiler's name and, since I use gcc, try to find
it in the path given by 'gcc -print-search-dirs'. Is this the right way?
I would expect that cmake defines a variable with this information
somewhere.

thanks,
Javier
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] gfortran

2008-01-24 Thread Javier Gonzalez

Bill Hoffman wrote:

Javier Gonzalez wrote:




I did it and it works (I removed the link just in case):

bash-3.2$ ls
hello.f90
bash-3.2$ cat hello.f90
PROGRAM HelloWorld
WRITE(*,*)  Hello World!
END PROGRAM
bash-3.2$ gfortran -o hello hello.f90
bash-3.2$ ./hello
Hello World!
bash-3.2$


OK, next step same program in CMake.
CMakeLists.txt
project(hello Fortran)
add_executable(hello hello.f90)

cmake .
make VERBOSE=1


What do you get?  What is different about the link line?

-Bill


That worked. The compile lines were:
/usr/bin/f95  -o CMakeFiles/hello.dir/hello.o   -c 
/home/jgonzalez/cmake-test/hello.f90

/usr/bin/f95   -fPIC   CMakeFiles/hello.dir/hello.o   -o hello -rdynamic

Now, I don't compile any fortran code as part of my project but link to 
a library that was compiled using gfortran. Apparently, to link I then 
need to add the gfortran library which is the one I'm having trouble with.


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


Re: [CMake] escaping!

2007-12-12 Thread Javier Gonzalez
Hi,

Well, these don't answer much. The first message (from Andrew) mentions
an option I have considered: writing everything on a script and calling
the script.

However, I thought it would be possible with cmake. The wiki just says:
You may need \\ instead of \ due to CMake argument processing. \ works
fine in SET statements, but you may need \\\ in some CMake functions.
It can get hairy. This section needs elaboration.

And that explains absolutely nothing. That is precisely the problem I
have and I tried many diferent things but none seemed to work.

Now, on a note... this problem appeared after I had been trying to do
something that I think can't be done with cmake. I will ask that
question but I would like to know how to solve this one.

Javier

Sylvain Benner wrote:

 I'm quite jaded about keeping CMakeLists.txt simple.  As far as I'm
 concerned, it should be as simple as the level of complication of your
 build.  If I want encapsulation, I write a macro.  Otherwise I'll just
 write straight CMake script, because I'd rather read CMake script than
 the docs of 5 different Unixy tools that all do their own kind of
 regular expression processing.
   
 I second this.
 We have a pretty big project and installer generation framework using
 CMake technology and it is very valuable to learn and master CMake
 scripting for a long-terme development.
 If everything is done with CMake you get more consistency and an easy
 and natural way to get access to your framework variables.

 Here is my advice:
 First think about how to do it the CMake way,then if it's not doable
 (which is pretty rare) do it with some other language.

 man cmake is your best friend ;-)

 --Sylvain

 ___
 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


[CMake] escaping!

2007-12-05 Thread Javier Gonzalez
Hi all,

Is it possible to have a command like this?
ADD_CUSTOM_COMMAND(OUTPUT ${my_file}
...
   COMMAND find . -name *xml  /dev/null
...
VERBATIM
)

I managed to get it working without the verbatim option but now I added
other things and it became a nightmare. I'm trying the verbatim option
under the assumption that it would make my life easier... oh well...

The following is a list of things I tried and the output (I have tried
other things and some of them give weird stuff)

in: find . -name *xml  /dev/null
out: find . -name *xml  /dev/null

in: find . -name \*xml\  /dev/null
out: find . -name \*xml\  /dev/null

in: find . -name \\*xml\\  /dev/null
out: find . -name \\\*xml\\\  /dev/null  (??)

in: find . -name \\\*xml\\\  /dev/null
out: find . -name \\\*xml\\\  /dev/null

in: find . -name *xml  /dev/null
out: find . -name  *xml   /dev/null

in: find . -name \\*xml  /dev/null
out: find . -name \\*xml  /dev/null

in: find . -name \*xml  /dev/null
gives error

in: find . -name \*xml\  /dev/null
out: find\ .\ -name\ *xml\ \ /dev/null

so? any idea?

Javier Gonzalez

p.s.: using cmake 2.4-patch 7 (is it fixed in a later version?)
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


[CMake] adding library

2007-10-10 Thread Javier Gonzalez
Hi all,

Quick question: isn't it possible to create a target library and later
specify the sources?  (ADD_LIBRARY first and something like
SET_TARGET_PROPERTIES(... SOURCES ...)  later) or at least add to the
sources.

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


[CMake] some dependency issues

2007-09-28 Thread Javier Gonzalez
Hi all,

I have a couple of comments/questions:

1.- I have a bunch of tests that I expect many people will not run all
the time so I excluded them from the 'all' target using EXCLUDE_FROM_ALL.
 The problem then was that when I did 'make test', the tests were not
build. I thought that dependency would be handled by ADD_TEST and when I
would do 'make test' it would then buil all the tests, but no. I then
tried using ADD_DEPENDENCIES(test ${MY_TEST_NAME}) only to discover that
there is no such target 'test' so I don't  know how to solve this.


2.- I have two subdirectories in my project: Utilities and Framework,
each with a target library. The second library depends on the first one.
The first library is small and the second one is very large. If I make a
small change in Utilities/CMakeLists.txt (remove white space, let's say)
then the thing goes and builds _everything_ in Utilities when I type
'make'. I could understand that although I think standard sources (like
.cc files) should be handled properly, if the source didn't change and
the dependencies are the same as before then it should not be re-built.
What I definitely don't understand is that it also builds everything in
the Framework directory! This is specially annoying since the directory
is large and there is no way anything that happened in the other
directory could affect it, the only dependency is through the library
and at most what I would expect is that the Framework library is linked
again.

What is happening? am I missing something? are these 'features' of
cmake? any idea on how to solve the problems?

I have a smaller project where the second issue doesn't occur (and I
still have two directories similarly structured). I will check what
makes the difference but any input will be appreciated!

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


Re: [CMake] CPack MacOSX bundle

2007-09-26 Thread Javier Gonzalez
Sean McBride wrote:
 On 9/25/07 12:06 PM, Félix C. Morency said:

   
 I'm trying to create a MacOSX bundle with my application. So far, everything
 is working (.dmg generation) except the fact that the application is always
 installed in /usr/bin. Is there any way to install it in the application
 menu ? I'm far from being a mac expert so I would need help please.
 

 Félix,

 Re-reading your post, I'm not sure I understand what you mean.  Could
 you elaborate?  What do you mean the application menu?

   

What he wants is to install it in /Applications instead of /usr/bin.
That is where Mac users expect packages to be installed.

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


[CMake] using CPack

2007-09-25 Thread Javier Gonzalez
Hi all,

I just started using cmake and it seems I can't figure out how to use
CPack. The documentation in the wiki page didn't help much.

I can do make, make install and it all works all right but if I do make
package I get and empty package (a tar ball with nothing in it). Also,
if I do make package_source the thing goes and compresses everything.
This last thing is not what I expected. I somehow expected to see only
the sources needed for the targets and that I would have to explicitly
say what to add on top of the required sources.

Obviously I have misunderstood the thing completely. For reference, this
is what I added to my CMakeLists.txt:

SET(CPACK_PACKAGE_VENDOR JGT)
SET(CPACK_PACKAGE_VERSION_MAJOR 1)
SET(CPACK_PACKAGE_VERSION_MINOR 0)
SET(CPACK_PACKAGE_VERSION_PATCH 0)
INCLUDE(CPack)

What else do I have to add to get something in the package?
What do I do to select the things that should go into the source tarball?

cheers,

Javier

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