Re: [CMake] Overriding intel default compiler flags

2010-09-30 Thread Marcel Loose
On Wed, 2010-09-29 at 18:16 +0200, pellegrini wrote:
> Hello everybody,
> 
> I come back with a question I asked yesterday but that I surely 
> misformulated. In the meantime I turned around
> the problem all the day but still without any results ...
> 
> I would like to build my project using ifort fortran compiler with a
set 
> of compiler flags different from the
> ones set by default by cmake in the "Windows-ifort.cmake" file of the 
> distribution.
> 
> I was advised on the list to not introduce any specific compiler flags

> declaration in my CMakeLists.txt and to
> introduce in my Src directory a Compiler/Intel-Fortran.cmake file 
> storing the following compiler flags I would like to be
> the default ones:
> 
> SET(CMAKE_BUILD_TYPE_INIT Release)
> SET(CMAKE_Fortran_FLAGS_INIT "")
> SET(CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full /check /traceback 
> /nologo")
> SET(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O2 /nologo
/Qvec-report0")
> SET(CMAKE_Fortran_FLAGS_RELEASE_INIT "/O2 /nologo /Qvec-report0")
> SET(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O2 /nologo
/traceback 
> /debug:full")
> 
>  Now my CMakeLists.txt file starts with:
> 
> cmake_minimum_required(VERSION 2.6.2)
> set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR})
> project(my_library Fortran)
> 
> Problem:
> in doing so, cmake actually parses my Intel-Fortran.cmake file but all

> the variables stored in there are subsequently replaced by the
> values stored in "Windows-ifort.cmake" during the "project" call. This

> does not happen when using the G95 to build my project because none
> of these variables are set in the Windows-G95-Fortran.cmake file (and 
> its dependancies).
> 
> Is that a known bug for intel fortran compiler ? Would you see any 
> work-around or should I introduce in the CMakeLists a conditional for
intel
> compiler breaking in that special case one of the cmake programming 
> rules ? !
> 
> thanks for your help
> 
> Eric
> 
> 
> 
Hi Eric,

It seems that both files are being included somehow; the latter
clobbering variables that were set in the former. I'm not an expert on
the compiler initialisation stuff and lots of things have changed
between 2.6 and 2.8. Which brings me to the following: your setting the
minimum required version to 2.6.2, however the Modules/Compiler
directory was introduced in 2.8. I'm not sure which version you're
actually using, but I assume you'll need 2.8 or higher for this to work.

Best regards,
Marcel Loose.


___
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] Overriding intel default compiler flags

2010-09-29 Thread pellegrini

Hello everybody,

I come back with a question I asked yesterday but that I surely 
misformulated. In the meantime I turned around

the problem all the day but still without any results ...

I would like to build my project using ifort fortran compiler with a set 
of compiler flags different from the
ones set by default by cmake in the "Windows-ifort.cmake" file of the 
distribution.


I was advised on the list to not introduce any specific compiler flags 
declaration in my CMakeLists.txt and to
introduce in my Src directory a Compiler/Intel-Fortran.cmake file 
storing the following compiler flags I would like to be

the default ones:

   SET(CMAKE_BUILD_TYPE_INIT Release)
   SET(CMAKE_Fortran_FLAGS_INIT "")
   SET(CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full /check /traceback 
/nologo")

   SET(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O2 /nologo /Qvec-report0")
   SET(CMAKE_Fortran_FLAGS_RELEASE_INIT "/O2 /nologo /Qvec-report0")
   SET(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O2 /nologo /traceback 
/debug:full")


Now my CMakeLists.txt file starts with:

cmake_minimum_required(VERSION 2.6.2)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR})
project(my_library Fortran)

Problem:
in doing so, cmake actually parses my Intel-Fortran.cmake file but all 
the variables stored in there are subsequently replaced by the
values stored in "Windows-ifort.cmake" during the "project" call. This 
does not happen when using the G95 to build my project because none
of these variables are set in the Windows-G95-Fortran.cmake file (and 
its dependancies).


Is that a known bug for intel fortran compiler ? Would you see any 
work-around or should I introduce in the CMakeLists a conditional for intel
compiler breaking in that special case one of the cmake programming 
rules ? !


thanks for your help

Eric



--
Eric Pellegrini
Calcul Scientifique
Insitut Laue-Langevin
Grenoble, France

___
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