dev-cafe / autocmake

CMake plugin composer.
http://autocmake.org
BSD 3-Clause "New" or "Revised" License
42 stars 18 forks source link

CMAKE_Fortran_FLAGS empty ? #131

Closed miroi closed 9 years ago

miroi commented 9 years ago

When printing CMAKE_Fortran_FLAGS, I see they are empty (see https://testboard.org/cdash/buildSummary.php?buildid=32904 ).

However, they are appearing in the compiling command of cmake, what is correct. Any help how to fill this variable in autocmake module(s) ?

bast commented 9 years ago

Difficult to say why it does not work without seeing the actual code.

miroi commented 9 years ago

Strange, that the CMAKE_Fortran_FLAGS variable is already empty in https://github.com/scisoft/autocmake/blob/master/compilers/GNU.Fortran.cmake#L3 . This is what printout says (I have CMake 2.8.12.2).

bast commented 9 years ago

I think this is not strange. What flags do you expect to see there?

miroi commented 9 years ago

I would welcome to see the employed flags;

for example, here it is "-O3 -funroll-all-loops" , but these are release-flags.

[ 50%] Building Fortran object src/CMakeFiles/example.dir/example.F90.o
cd /home/milias/Work/qch/software/software_projects/mathlibs-tester_devel/mathlibs-tester_devel/build/src && /usr/bin/gfortran  -DHAVE_MKL_BLAS -DHAVE_MKL_LAPACK -O3 -funroll-all-loops -J../modules -I/home/milias/Work/qch/software/software_projects/mathlibs-tester_devel/mathlibs-tester_devel/build/modules -I/home/milias/Work/qch/software/software_projects/mathlibs-tester_devel/mathlibs-tester_devel/build    -c /home/milias/Work/qch/software/software_projects/mathlibs-tester_devel/mathlibs-tester_devel/src/example.F90 -o CMakeFiles/example.dir/example.F90.o

I found here this receipe to preserve flags, will try it: http://www.cmake.org/pipermail/cmake/2013-August/055473.html


Well, receipe is not working ... default flags are empty.

bast commented 9 years ago

Since I cannot see your code I cannot comment on why it fails. Normally it should work.

miroi commented 9 years ago

Code is here: https://github.com/miroi/mathlibs-tester

CDash outputs: https://testboard.org/cdash/index.php?project=MathLibs-tester

bast commented 9 years ago

And where can I see or find the print statement which fails?

miroi commented 9 years ago

Hi,

the statemenet is here : https://github.com/miroi/mathlibs-tester/blob/master/cmake/custom/build_info.cmake#L63

But you can check it simply by putting simple printout message into https://github.com/miroi/mathlibs-tester/blob/master/cmake/downloaded/autocmake_GNU.Fortran.cmake

or directly into the autocmake's module, https://github.com/scisoft/autocmake/blob/master/compilers/GNU.Fortran.cmake

I think later, we should introduce the test for _buildinfo printouts, similar to existing fc_git_info. M.

bast commented 9 years ago

In this project you use https://github.com/scisoft/autocmake/blob/master/compilers/GNU.Fortran.cmake as far as I can see. And there are no flags. So I don't understand what does not work. I would expect to see no flags in your printout as well.

miroi commented 9 years ago

In such case I would be glad to print out used flags, like we had in DIRAC (for example, see https://testboard.org/cdash/buildSummary.php?buildid=21237 ).

The command "make VERBOSE=1" does show used flags (see https://github.com/scisoft/autocmake/issues/131#issuecomment-140412788) , how to get them printed ?

bast commented 9 years ago

What you see printed there is CMAKE_Fortran_FLAGS_RELEASE. So you just need to print the right variables. Perhaps you want to print all of them. I am now closing this issue since this is now clearly not an Autocmake issue.

miroi commented 9 years ago

Yes, the best would be printing all flags associated with the given compiler/linker, but the art ("science") is to find proper CMake variable(s) for that printing. I can't find them...do they exist ?

bast commented 9 years ago

http://www.cmake.org/Wiki/CMake_Useful_Variables

miroi commented 9 years ago

thanks; this helps only partially....

bast commented 9 years ago

Please tell me what is not clear yet.

miroi commented 9 years ago

Well, simply I can not get all what I want;

GNU does not have compiler flags set: https://testboard.org/cdash/buildSummary.php?buildid=32922

while PGI has some setting: https://testboard.org/cdash/buildSummary.php?buildid=32963

I think I can not get more from CMake, this should be sufficient; together with printing out git_info data.

bast commented 9 years ago

You write that you cannot get all what you want. What is it that you want?

miroi commented 9 years ago

I wanted the full string of compilation flags/preprocessor etc as are shown with the make VERBOSE=1 command, see https://github.com/scisoft/autocmake/issues/131#issuecomment-140412788 .

Maybe I can get something more, I 'll play with printouts a liitle.

bast commented 9 years ago

The full string is a combination of several variables: CMAKE_Fortran_FLAGS, CMAKE_Fortran_FLAGS_RELEASE or CMAKE_Fortran_FLAGS_DEBUG (depending on whether it's release or debug), and preprocessing definitions.

miroi commented 9 years ago

Yes, plus user extra compilers flags might be there.

To have more complex ground for the development of the _buildinfo custom module, I'll move to dedicated DIRAC branch. There I can explore more possibilities and pick the best for CMake/dirac.x print-outs.