[cmake-developers] [CMake 0012215]: CMake Not Detecting Basic Fortran Dependencies

2011-05-23 Thread Mantis Bug Tracker

The following issue has been SUBMITTED. 
== 
http://www.vtk.org/Bug/view.php?id=12215 
== 
Reported By:Mohamad Sindi
Assigned To:
== 
Project:CMake
Issue ID:   12215
Category:   CMake
Reproducibility:always
Severity:   major
Priority:   normal
Status: new
== 
Date Submitted: 2011-05-23 13:54 AST
Last Modified:  2011-05-23 13:54 AST
== 
Summary:CMake Not Detecting Basic Fortran Dependencies
Description: 
I have the below directory structure for Fortran code which has very basic
dependencies, yet CMake seems to fail to recognize the dependencies:

src/

CMakeLists.txt

lib1/CMakeLists.txt
lib1/lib1.f

lib2/CMakeLists.txt
lib2/lib2.f

lib3/CMakeLists.txt
lib3/lib3.f

main/CMakeLists.txt
main/myMain.f


Dependencies are:
myMain uses lib3
lib3   uses lib2
lib2   uses lib1


My top directory CMakeLists.txt looks like this:
[sindimo@lnx src]$ cat CMakeLists.txt
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
PROJECT(Fortran-Example-Dependency-Failure Fortran)

INCLUDE_DIRECTORIES(/workspace/Fortran-Example-Dependency-Failure/obj/linux_gnu_release_64-bit)

set (EXECUTABLE_OUTPUT_PATH
"/workspace/Fortran-Example-Dependency-Failure/bin/linux_gnu_release_64-bit")
set (LIBRARY_OUTPUT_PATH
"/workspace/Fortran-Example-Dependency-Failure/obj/linux_gnu_release_64-bit")
set (CMAKE_Fortran_MODULE_DIRECTORY
"/workspace/Fortran-Example-Dependency-Failure/obj/linux_gnu_release_64-bit")

ADD_SUBDIRECTORY(lib3)
ADD_SUBDIRECTORY(lib2)
ADD_SUBDIRECTORY(lib1)
ADD_SUBDIRECTORY(main)


The subdirectory CMakeLists.txt files look like:
[sindimo@lnx src]$ cat lib1/CMakeLists.txt 
ADD_LIBRARY(lib1 SHARED  lib1.f)

[sindimo@lnx src]$ cat lib2/CMakeLists.txt
ADD_LIBRARY(lib2 SHARED  lib2.f)

[sindimo@lnx src]$ cat lib3/CMakeLists.txt
ADD_LIBRARY(lib3 SHARED  lib3.f)

[sindimo@lnx src]$ cat main/CMakeLists.txt 
ADD_EXECUTABLE(Fortran-Example-Dependency-Failure.exe  myMain.f)
TARGET_LINK_LIBRARIES(Fortran-Example-Dependency-Failure.exe  lib1 lib2 lib3)


When I run cmake followed by make I get the below error which apparently seems
to be due to CMake not figuring out the correct dependencies in Fortran and
doing the wrong build sequence:
[sindimo@lnx build_linux_gnu_release_64-bit]$ cmake ../src
-- The CXX compiler identification is GNU
-- The Fortran compiler identification is GNU
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working Fortran compiler: /usr/bin/gfortran
-- Check for working Fortran compiler: /usr/bin/gfortran  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/gfortran supports Fortran 90
-- Checking whether /usr/bin/gfortran supports Fortran 90 -- yes
-- Configuring done
-- Generating done
-- Build files have been written to:
/workspace/Fortran-Example-Dependency-Failure/build_linux_gnu_release_64-bit

[sindimo@lnx build_linux_gnu_release_64-bit]$ make
Scanning dependencies of target lib3
[ 25%] Building Fortran object lib3/CMakeFiles/lib3.dir/lib3.f.o
 In file /workspace/Fortran-Example-Dependency-Failure/src/lib3/lib3.f:6

use m_lib2  
   1
Fatal Error: Can't open module file 'm_lib2.mod' for reading at (1): No such
file or directory
make[2]: *** [lib3/CMakeFiles/lib3.dir/lib3.f.o] Error 1
make[1]: *** [lib3/CMakeFiles/lib3.dir/all] Error 2
make: *** [all] Error 2


To my understanding CMake should be able to handle such simple Fortran
dependencies (as I recall, it uses similar intelligence to that of makedepf90),
am I doing something wrong here or is this considered too complicated of a
Fortran dependency for CMake to handle?

As a work around, if I add the below dependency statements manually to the top
level CMakeLists.txt file, things go well:
ADD_DEPENDENCIES(lib2 lib1)
ADD_DEPENDENCIES(lib3 lib2)

Also if I sort the ADD_SUBDIRECTORY commands in the correct build sequence, that
obviously solves the problem as well.

However our actual application that we need to use CMake with consists of
hundreds of libraries, so adding these dependencies manually or sorting them in
the correct build sequence is not feasible.

The "Mastering CMake" 4th edition book mentions an "output_required_files"
command which should take a source file and

Re: [cmake-developers] Automatically deleted branch when merged to next?

2011-05-23 Thread Brad King
On 05/21/2011 06:43 AM, Eric Noulard wrote:
> Just curious but my last stage-->next merge triggered this:
> 
> Fetching upstream next
> Merge topic 'CPackRPM-fixForAIX' into next
> 
> db45b10 CPack  make RPM work on AIX. fix #0012183 merge patch from Pasi 
> Valminen
> 41c83c1 KWSys Nightly Date Stamp
> Pushing upstream next
> To g...@cmake.org:cmake.git
> Deleting fully merged topic 'CPackRPM-fixForAIX' (db45b10) from stage.
> 
> The very last part is new to me.
> Was it done to avoid several may-be-wrong re-merge using the same branch?
> 
> Does it imply that a stage branch which has been merged to next is to
> be considered over?
> Say that I want to push my merged branch forward?
> Shall I push and merge again or shall I start over with a new branch
> using a different name?

Ignore it.  It was a bug on server's stage logic which I've now fixed.
Ironically I introduced the bug late last week while adding unit tests
for the stage scripts.  My fix includes a test for this case ;)

I also restored your topic.  It's still in next but not yet in master
as usual.

Thanks,
-Brad
___
cmake-developers mailing list
cmake-developers@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Getting changes into master

2011-05-23 Thread Brad King
On 05/21/2011 04:59 AM, Eric Noulard wrote:
> You don't merge to master yourself, Kitware guys do.
> If your merge to next did not make some dashboard go red.
> 
> Dave, Brad, Bill & co do review (something like every week on tuesday I think)
> the change which reached next which deserve to go to master.

Correct.  I just added a couple sentences describing this at the bottom of
the section:

  http://www.cmake.org/Wiki/CMake/Git#Topic_Stage

-Brad
___
cmake-developers mailing list
cmake-developers@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Automatically deleted branch when merged to next?

2011-05-23 Thread Eric Noulard
2011/5/23 Brad King :
> On 05/21/2011 06:43 AM, Eric Noulard wrote:
>> Just curious but my last stage-->next merge triggered this:
>>
>> Fetching upstream next
>> Merge topic 'CPackRPM-fixForAIX' into next
>>
>> db45b10 CPack  make RPM work on AIX. fix #0012183 merge patch from Pasi 
>> Valminen
>> 41c83c1 KWSys Nightly Date Stamp
>> Pushing upstream next
>> To g...@cmake.org:cmake.git
>> Deleting fully merged topic 'CPackRPM-fixForAIX' (db45b10) from stage.
>>
>> The very last part is new to me.
>> Was it done to avoid several may-be-wrong re-merge using the same branch?
>>
>> Does it imply that a stage branch which has been merged to next is to
>> be considered over?
>> Say that I want to push my merged branch forward?
>> Shall I push and merge again or shall I start over with a new branch
>> using a different name?
>
> Ignore it.  It was a bug on server's stage logic which I've now fixed.
> Ironically I introduced the bug late last week while adding unit tests
> for the stage scripts.  My fix includes a test for this case ;)

Then you need test for testing the test :-]
Just kidding...

> I also restored your topic.  It's still in next but not yet in master
> as usual.

ok thanks.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
___
cmake-developers mailing list
cmake-developers@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers