[CMake] Fwd: Bug fix requests for the *next* release of CMake...

2010-11-12 Thread David Hunter
I would second this, I have been manually removing the CMAKE_INTDIR by
hand, I'm not sure why it's even there for C++ compiles. I prefer my
compile lines as clean and simple as possible and I don't use this
compile line define anywhere. If I want a compile line define to
indicate what CMAKE_INT does I can add it myself very easily but I
don't see any easy way to make it not added of to remove it. Which
segways me into

1) Does the patch you mention remove all the C++ defines from the midl
command line? To my mind the defines you would want for IDL and C++
are pretty orthoginal so why force one on the other

2) Is there a general standard way to change the default flags you get
for the compile line. As a for instance on a VS 10 debug build you get
-RTC1 added which causes, amongst other things run time checking of
undefined variable. This is toxic at run time for Boost which uses
undefined variables for their types not their values so you get a
runtime exception and I'm not man enough to attempt to play in the
Boost code base. The only way I managed to get this flag changed,
after various failed attempts at regex replacment of CMAKE variable
and other Web suggested things, to the less problematic -RTCs was do
download the source code replace RTC1 wherever I found it and build my
own patched version. This seems a bit extreme. If someone know
standard way of changing the default compile line switches for a given
project, in other words not not by modifying you standard cmake
install, can it be added to the FAQ/Wiki?

Thanks


On Thu, Nov 11, 2010 at 11:52 PM, Tony Bridges  wrote:
> Hi David,
>
> 0008165 - vs2005 midl chokes on CMAKE_INTDIR  (also 2008)
>  http://public.kitware.com/Bug/view.php?id=8165
>
> I would love to see a fix for 0008165 in the next version.
>
> Each new version we pick up, I have to reapply Robert Lenhardt's patch and 
> rebuild.
>   http://public.kitware.com/Bug/file_download.php?file_id=1887&type=bug
> The change is simple and isolated, from what I can see.
>
> Thanks!
> /t
>
>
> -Original Message-
> From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf Of 
> David Cole
> Sent: Wednesday, November 10, 2010 12:53 PM
> To: Adam J Richardson
> Cc: cmake@cmake.org
> Subject: Re: [CMake] Bug fix requests for the *next* release of CMake...
>
> On Fri, Nov 5, 2010 at 6:29 AM, Adam J Richardson  
> wrote:
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA1
>>
>> Hi David,
>>
>>> Replies requested.
>>
>> CMake is already pretty awesome from my POV, but since you ask...
>>
>>> Replies on this thread should just be a collector for bug numbers.
>>
>> Afraid I don't have a bug number, but I can explain quickly.
>>
>>> If you have a particular issue that you think should be fixed for
>>> inclusion in 2.8.4, please bring it up now.
>>
>> Could you guys have a chat with the Boost guys and fix the "future
>> safety" of FindBoost.cmake somehow? Fiddling with ADDITIONAL_VERSIONS
>> is really a pain on a build farm.
>>
>> Oh, and include Mateusz Loskot's FindODBC.cmake in the release?
>
> To include a new module in CMake, we need a module maintainer for it, as 
> outlined here:
> http://www.cmake.org/Wiki/CMake:Module_Maintainers
>
> So unless there is a volunteer for FindODBC, it will not be in CMake.
>
> Let me know if you or somebody you know wants to be that volunteer.
>
>
> David
>
>
>>
>> Thanks,
>> Adam J Richardson
>> -BEGIN PGP SIGNATURE-
>> Version: GnuPG v1.4.10 (GNU/Linux)
>>
>> iEYEARECAAYFAkzT3GwACgkQSUH6dLOqvqlyOQCfaC2+BL+jkULzetoh3bduWoHU
>> tmMAniddpSiMW4KpeRjpS0me9C+3RNjm
>> =4TE7
>> -END PGP SIGNATURE-
>>
> ___
> 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
>
> -
> This transmission (including any attachments) may contain confidential 
> information, privileged material (including material protected by the 
> solicitor-client or other applicable privileges), or constitute non-public 
> information. Any use of this information by anyone other than the intended 
> recipient is prohibited. If you have received this transmission in error, 
> please immediately reply to the sender and delete this information from your 
> system. Use, dissemination, distribution, or reproduction of this 
> transmission by unintended recipients is not authorized and may be unlawful.
> ___
> 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 sub

[CMake] discussion about bug 8165

2010-11-12 Thread David Cole
The thread you replied is meant for bug number listing only. I've
started a new thread to continue this discussion. It should really be
recorded in the bug notes since it's specific to that bug...

http://public.kitware.com/Bug/view.php?id=8165

On Fri, Nov 12, 2010 at 3:24 AM, David Hunter  wrote:
> I would second this, I have been manually removing the CMAKE_INTDIR by
> hand, I'm not sure why it's even there for C++ compiles. I prefer my
> compile lines as clean and simple as possible and I don't use this
> compile line define anywhere. If I want a compile line define to
> indicate what CMAKE_INT does I can add it myself very easily but I
> don't see any easy way to make it not added of to remove it. Which
> segways me into
>
> 1) Does the patch you mention remove all the C++ defines from the midl
> command line? To my mind the defines you would want for IDL and C++
> are pretty orthoginal so why force one on the other

No, the patch does not remove all C++ defines from the midl command
line. It simply addresses passing the single define in question to
midl in a different way.

The defines for IDL and C++ files in any given project may, but
certainly do not have to, overlap. In a CMake generated project, they
do overlap. As do defines for any added *.rc files. While I agree with
you that they probably should be orthogonally controllable, I don't
think changing CMake's behavior at this point would be beneficial for
the people who have become used to it the way it is... However, I
could be persuaded that we should adopt a new behavior (by CMake's
policy mechanism so that people can still keep the old behavior for a
while as they transition to the new behavior) if there is sufficient
interest.

It's kind of a lot of work for a fairly small feature, though.

People who really want different midl command lines can always use
CMake's add_custom_command to drive midl themselves with the exact
command line of interest. (And then do NOT add the idl file as a
source, but simply make your dll or exe depend on the output of the
custom command...)

This is all very Visual Studio specific, so it's not very high on the
radar compared to CMake features that affect all (multiple-platform,
multiple-compiler) users.


>
> 2) Is there a general standard way to change the default flags you get
> for the compile line. As a for instance on a VS 10 debug build you get
> -RTC1 added which causes, amongst other things run time checking of
> undefined variable. This is toxic at run time for Boost which uses
> undefined variables for their types not their values so you get a
> runtime exception and I'm not man enough to attempt to play in the
> Boost code base. The only way I managed to get this flag changed,
> after various failed attempts at regex replacment of CMAKE variable
> and other Web suggested things, to the less problematic -RTCs was do
> download the source code replace RTC1 wherever I found it and build my
> own patched version. This seems a bit extreme. If someone know
> standard way of changing the default compile line switches for a given
> project, in other words not not by modifying you standard cmake
> install, can it be added to the FAQ/Wiki?
>

The default values in question come from the file
Modules/Platform/Windows-cl.cmake and are defined as:
  SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1")
  SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi  /Ob0 /Od /RTC1")

The way to change the defaults for everybody is to change that file.
(As it appears you've been doing...)

You could change them in your project's CMakeLists.txt file like this:

if(CMAKE_CXX_FLAGS_DEBUG MATCHES "/RTC1")
  string(REPLACE "/RTC1" "xxx"
CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
  message(STATUS "info: replaced '/RTC1' in CMAKE_CXX_FLAGS_DEBUG with 'xxx'
Value of CMAKE_CXX_FLAGS_DEBUG seen in cmake-gui is being
overridden with:
CMAKE_CXX_FLAGS_DEBUG='${CMAKE_CXX_FLAGS_DEBUG}'")
endif()

if(CMAKE_C_FLAGS_DEBUG MATCHES "/RTC1")
  string(REPLACE "/RTC1" "xxx"
CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
  message(STATUS "info: replaced '/RTC1' in CMAKE_C_FLAGS_DEBUG with 'xxx'
Value of CMAKE_C_FLAGS_DEBUG seen in cmake-gui is being overridden with:
CMAKE_C_FLAGS_DEBUG='${CMAKE_C_FLAGS_DEBUG}'")
endif()

Or you can observe what their default values are, and then construct
full replacements for them, and pass them in with -D on the cmake
command line.


Hope this helps,
David


> Thanks
>
>
> On Thu, Nov 11, 2010 at 11:52 PM, Tony Bridges  wrote:
>> Hi David,
>>
>> 0008165 - vs2005 midl chokes on CMAKE_INTDIR  (also 2008)
>>  http://public.kitware.com/Bug/view.php?id=8165
>>
>> I would love to see a fix for 0008165 in the next version.
>>
>> Each new version we pick up, I have to reapply Robert Lenhardt's patch and 
>> rebuild.
>>   http://public.kitware.com/Bug/file_download.php?file_id=1887&type=bug
>> The change is simple and isolated, from what I can see.
>>
>> Thanks!
>

Re: [CMake] un circle dependency

2010-11-12 Thread luxInteg
On Thursday 11 November 2010 21:55:31 Alexander Neundorf wrote:
> On Thursday 11 November 2010, luxInteg wrote:
> > Greetings
> > 
> > I am learning cmake.
> > 
> >   I think I now know how to generate libraries and executables but  I
> >   have
> > 
> > not yet grasped  how  the tree and   directory structure is handled and
> > by conseqence how one navigates therein.
> > 
> > 
> > I have this problem.  Lets say my   build tree has these directories
> > 
> > L---$originalSourceTree/build/lib
> > M---$originalSourceTree/build/bin
> > 
> > libraries   say libA.so libB.a are in L.  I want to generate  
> > executables A.bin and B.bin in M but
> > they each need  to link to  newly generated  libraries  libA.so libB.a
> > 
> > 
> > a) how do I direct cmake  (in the CMakeLists.txt/base directory) to build
> > the libraries in ( L )above   first  -i.e. before atempting to do finds
> > of nonexistant libraries  ?
> 
> The add_library() commands must be before the add_executable() commands,
> otherwise the libraries "A" and "B" are not yet know when you do
> target_link_libraries(exe A B)
> 
> Beside that, the dependencies in the generated makefiles are complete, so
> whenever you do a build, cmake makes sure that the libraries are up-to-date
> before it builds the executable.
> 
> > b) if I   insert lines such 'find_library(LIB  libA  path ../lib'   in
> > the CmakeLists.txt in the base directory  this  results in an error  so
> > what does one insert?
> 
> find_library() is not necessary, you can simply use the names of the
> library targets when linking against them.

thanks  for the help,

I added 

ADD_DEPENDENCIES(libA  ../path/to/A_exec )

to the CMakeLists.txt in  ~/lib directory (i.e.L)

---AND
add_executable(A.exec fileA.c)
target_link_libraries(A.exec  libA )

to the CMakeLists.txt  in the ~/bin directory (i.e.M) a

and it seems to have worked



-A   related problem is   described below

I have this  file:- (orig_A_exec.out) in in the ~/bin (of the source tree)
after building A_exec  as explained above   I tried running the shall command 
below

EXECUTE_PROCESS(COMMAND ./A_exec > new_A_exec.out  
- diff orig_A_exec.out   new_A_exec.out )

but I did not see  neither new_A_exec.out  nor orig_A_exec.out in ~/bin in 
the build directory (i.e.M) i.e nothing happened.


I am using a bash  shell.  some guidance on how to execute bash  commands in 
cmake  would be appreciated.


luxInteg
___
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] making executible in mixed C/fortran project

2010-11-12 Thread luxInteg
Greetings,

I am learning cmake

I am building an executable  which needs to   first compile a C program  and 
then recompiling the object file   with another file in fortran.


Here is  an excerpt from a unix makefile I am attempt to port to cmake as part 
of my cmake turotial.

fileC.o: fileC.c
$(C) -DDINT -c fileC.c

fileD:  fileD.f fileC.o ../lib/libF.a
$(F77) $(F77FLAGS) -o fileD fileD.f fileC.o../lib/libF.a $(F77LIB)



I  think I have learnt enough cmake to do most of the above  EXCEPT I am 
unsure how on compile an object file  (in this case  fileC.o
with a fortran compiler (if I have translated the makefile correctly)
 Does one  rename   the file or whatever?
Guidance on how to do this would be appreciated
___
Powered by www.kitware.com

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

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

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


[CMake] How to install openbabel python bindings by using the new cmake installer (problem selecting a particular python version).

2010-11-12 Thread Hector Martinez-Seara
Dear all,
I'm trying to install openbabel in linux which in its last version
(2.3.0) uses cmake installer. I haven't been able to compile it with
biddings with python 3.1 when using the -DPYTHON_BINDINGS=ON option. I
have python 2.7 and 3.1 installed in my system and the python command
points to python 3.1. Still cmake only select python 2.7 despite it is
not set as preferred in my system in any way. I have made a small
search and I have seen that there is a lot of troubles selecting
python 3 with cmake. Most of the information was very technical and
honestly I'm not sure if there was any solution at the end.
My question is rather easy:
a) Is there any way to force a specific python version (3.1) from the
cmake command line?
or b) Is there variable which I could export, e.g. CC=gcc4.5, to force
python to select the python version I want?
Thanks in advance,
Hector
___
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] making executible in mixed C/fortran project

2010-11-12 Thread Michael Hertling
On 11/12/2010 02:46 PM, luxInteg wrote:
> Greetings,
> 
> I am learning cmake
> 
> I am building an executable  which needs to   first compile a C program  and 
> then recompiling the object file   with another file in fortran.
> 
> 
> Here is  an excerpt from a unix makefile I am attempt to port to cmake as 
> part 
> of my cmake turotial.
> 
> fileC.o: fileC.c
>   $(C) -DDINT -c fileC.c
> 
> fileD:  fileD.f fileC.o ../lib/libF.a
>   $(F77) $(F77FLAGS) -o fileD fileD.f fileC.o../lib/libF.a $(F77LIB)
> 
> 
> 
> I  think I have learnt enough cmake to do most of the above  EXCEPT I am 
> unsure how on compile an object file  (in this case  fileC.o
> with a fortran compiler (if I have translated the makefile correctly)
>  Does one  rename   the file or whatever?
> Guidance on how to do this would be appreciated

You might try

ADD_LIBRARY(C STATIC fileC.c)

in junction with

TARGET_LINK_LIBRARIES(fileD C ...)

since you shouldn't directly refer to object files with CMake.

Regards,

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] un circle dependency

2010-11-12 Thread Michael Hertling
On 11/12/2010 02:47 PM, luxInteg wrote:
> On Thursday 11 November 2010 21:55:31 Alexander Neundorf wrote:
>> On Thursday 11 November 2010, luxInteg wrote:
>>> Greetings
>>>
>>> I am learning cmake.
>>>
>>>   I think I now know how to generate libraries and executables but  I
>>>   have
>>>
>>> not yet grasped  how  the tree and   directory structure is handled and
>>> by conseqence how one navigates therein.
>>>
>>>
>>> I have this problem.  Lets say my   build tree has these directories
>>>
>>> L---$originalSourceTree/build/lib
>>> M---$originalSourceTree/build/bin
>>>
>>> libraries   say libA.so libB.a are in L.  I want to generate  
>>> executables A.bin and B.bin in M but
>>> they each need  to link to  newly generated  libraries  libA.so libB.a
>>>
>>>
>>> a) how do I direct cmake  (in the CMakeLists.txt/base directory) to build
>>> the libraries in ( L )above   first  -i.e. before atempting to do finds
>>> of nonexistant libraries  ?
>>
>> The add_library() commands must be before the add_executable() commands,
>> otherwise the libraries "A" and "B" are not yet know when you do
>> target_link_libraries(exe A B)
>>
>> Beside that, the dependencies in the generated makefiles are complete, so
>> whenever you do a build, cmake makes sure that the libraries are up-to-date
>> before it builds the executable.
>>
>>> b) if I   insert lines such 'find_library(LIB  libA  path ../lib'   in
>>> the CmakeLists.txt in the base directory  this  results in an error  so
>>> what does one insert?
>>
>> find_library() is not necessary, you can simply use the names of the
>> library targets when linking against them.
> 
> thanks  for the help,
> 
> I added 
> 
> ADD_DEPENDENCIES(libA  ../path/to/A_exec )
> 
> to the CMakeLists.txt in  ~/lib directory (i.e.L)

Besides the fact that this line would establish a dependency *of* libA
*on* A_exec - from your initial post, I cannot see such a necessity -
it actually does nothing as "../path/to/A_exec" is no logical target
in your project, I suppose, but ADD_DEPENDENCIES() operates on such
targets only. BTW, are you sure you have a circular dependency, i.e.
A_exec depends on libA depends on A_exec?

> ---AND
> add_executable(A.exec fileA.c)
> target_link_libraries(A.exec  libA )
> 
> to the CMakeLists.txt  in the ~/bin directory (i.e.M) a
> 
> and it seems to have worked

The TARGET_LINK_LIBRARIES() is absolutely right and also sufficient, IMO.

> -A   related problem is   described below
> 
> I have this  file:- (orig_A_exec.out) in in the ~/bin (of the source tree)
> after building A_exec  as explained above   I tried running the shall command 
> below
> 
> EXECUTE_PROCESS(COMMAND ./A_exec > new_A_exec.out  
> - diff orig_A_exec.out   new_A_exec.out )
> 
> but I did not see  neither new_A_exec.out  nor orig_A_exec.out in ~/bin 
> in 
> the build directory (i.e.M) i.e nothing happened.
> 
> 
> I am using a bash  shell.  some guidance on how to execute bash  commands in 
> cmake  would be appreciated.

EXECUTE_PROCESS() is run at configuration time, i.e. when CMake runs,
but at that time, your A_exec hasn't been built, yet, or stems from a
previous build in which case it is outdated, so you don't want to run
it in order to check its output. If you want to run an executable after
it has been built use ADD_CUSTOM_COMMAND(TARGET ...) or ADD_TEST() with
"make test" or CTest as suggested recently for your BouncyBall example.

Regards,

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] How to compile PHP with cmake in windows?

2010-11-12 Thread Mr Shore
Hi there!

Anyone tried this and got good results?

After google I only found those ugly way to compile PHP in its traditional
way,glad if anyone can provide some info on this..
___
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] making executible in mixed C/fortran project

2010-11-12 Thread luxInteg
On Friday 12 November 2010 13:17:50 Michael Hertling wrote:
> On 11/12/2010 02:46 PM, luxInteg wrote:
> > Greetings,
> > 
> > I am learning cmake
> > 
> > I am building an executable  which needs to   first compile a C program 
> > and then recompiling the object file   with another file in fortran.
> > 
> > 
> > Here is  an excerpt from a unix makefile I am attempt to port to cmake as
> > part of my cmake turotial.
> > 
> > fileC.o: fileC.c
> > 
> > $(C) -DDINT -c fileC.c
> > 
> > fileD:  fileD.f fileC.o ../lib/libF.a
> > 
> > $(F77) $(F77FLAGS) -o fileD fileD.f fileC.o../lib/libF.a $(F77LIB)
> > 
> > I  think I have learnt enough cmake to do most of the above  EXCEPT I am
> > unsure how on compile an object file  (in this case  fileC.o
> > with a fortran compiler (if I have translated the makefile correctly)
> > 
> >  Does one  rename   the file or whatever?
> > 
> > Guidance on how to do this would be appreciated
> 
> You might try
> 
> ADD_LIBRARY(C STATIC fileC.c)
> 
> in junction with
> 
> TARGET_LINK_LIBRARIES(fileD C ...)


It would not go in the loop 

add_executable(fileD
fileD.f 
ADD_LIBRARY(fileC STATIC fileC.c )
${fileC}  )


so I tried  it outside like so:-

SET_SOURCE_FILES_PROPERTIES( fileC.c  PROPERTIES  COMPILE_DEFINITIONS DINT )
ADD_LIBRARY(fileC STATIC fileC.c )
add_executable(fileD
fileD.f 
${fileC}  )

target_link_libraries(fileD   $(F77LIB) )


---but  make ends like so:-
CMakeFiles/filedD.dir/filedD.f.o: In function `MAIN__':
filedD.f:(.text+0x2f9): undefined reference to `Ddefaults_'
filedD.f:(.text+0x32b): undefined reference to `Dorder_'
filedD.f:(.text+0x33a): undefined reference to `Dinfo_'
collect2: ld returned 1 exit status

---

oher suggestions welcomed
> since you shouldn't directly refer to object files with 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] making executible in mixed C/fortran project

2010-11-12 Thread Michael Hertling
On 11/12/2010 05:37 PM, luxInteg wrote:
> On Friday 12 November 2010 13:17:50 Michael Hertling wrote:
>> On 11/12/2010 02:46 PM, luxInteg wrote:
>>> Greetings,
>>>
>>> I am learning cmake
>>>
>>> I am building an executable  which needs to   first compile a C program 
>>> and then recompiling the object file   with another file in fortran.
>>>
>>>
>>> Here is  an excerpt from a unix makefile I am attempt to port to cmake as
>>> part of my cmake turotial.
>>>
>>> fileC.o: fileC.c
>>>
>>> $(C) -DDINT -c fileC.c
>>>
>>> fileD:  fileD.f fileC.o ../lib/libF.a
>>>
>>> $(F77) $(F77FLAGS) -o fileD fileD.f fileC.o../lib/libF.a $(F77LIB)
>>>
>>> I  think I have learnt enough cmake to do most of the above  EXCEPT I am
>>> unsure how on compile an object file  (in this case  fileC.o
>>> with a fortran compiler (if I have translated the makefile correctly)
>>>
>>>  Does one  rename   the file or whatever?
>>>
>>> Guidance on how to do this would be appreciated
>>
>> You might try
>>
>> ADD_LIBRARY(C STATIC fileC.c)
>>
>> in junction with
>>
>> TARGET_LINK_LIBRARIES(fileD C ...)
> 
> 
> It would not go in the loop 
> 
> add_executable(fileD
> fileD.f 
> ADD_LIBRARY(fileC STATIC fileC.c )
> ${fileC}  )

Which loop are you talking about, and which value does the "fileC"
variable has here? Moreover, the ADD_LIBRARY() command must not
appear among the source files of ADD_EXECUTABLE(), of course.

> so I tried  it outside like so:-
> 
> SET_SOURCE_FILES_PROPERTIES( fileC.c  PROPERTIES  COMPILE_DEFINITIONS DINT )
> ADD_LIBRARY(fileC STATIC fileC.c )
> add_executable(fileD
> fileD.f 
> ${fileC}  )
> 
> target_link_libraries(fileD   $(F77LIB) )

That's better, but you need to mention the fileC library target in
TARGET_LINK_LIBRARIES() for this to work, and again: What's the value
of the "fileC" variable here? Note that you've an equally named target.

If you don't really intent to re-use fileC.c, but just want to mix it
with the Fortran sources of fileD, you can do so, i.e. you might say

ADD_EXECUTABLE(fileD fileD.f fileC.c)

but when mixing several languages read about the LINKER_LANGUAGE
target property as well as the CMAKE__LINKER_PREFERENCE
and CMAKE__LINKER_PREFERENCE_PROPAGATES variables.

> ---but  make ends like so:-
> CMakeFiles/filedD.dir/filedD.f.o: In function `MAIN__':
> filedD.f:(.text+0x2f9): undefined reference to `Ddefaults_'
> filedD.f:(.text+0x32b): undefined reference to `Dorder_'
> filedD.f:(.text+0x33a): undefined reference to `Dinfo_'
> collect2: ld returned 1 exit status

Usually, that means there are missing sources in ADD_EXECUTABLE() or
missing libraries in TARGET_LINK_LIBRARIES(); perhaps, you can post
a complete but minimal example as a demonstration of this issue.

> oher suggestions welcomed
>> since you shouldn't directly refer to object files with CMake.

Regards,

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