[CMake] Compilation options

Benjamin Depardon Benjamin.Depardon at ens-lyon.fr
Fri Jun 20 02:03:41 EDT 2008


In fact I'm using the TAU compiler, which is a script that modify the  
code before compiling it with a standard compiler (gcc).
My problem is that CMake adds a-D<name of the file>_EXPORTS flag  
before any of my flags when it calls the compiler (script).
So I think that even changing these lines won't work.
SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E  
<SOURCE> > <PREPROCESSED_SOURCE>")
   SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -S  
<SOURCE> -o <ASSEMBLY_SOURCE>")

My question is why does it adds such a flag, and can we choose its  
position inside the <FLAGS> list?

Thanks
Ben

Le 17 juin 08 à 13:58, Mathieu Malaterre a écrit :

> What compiler are you using ?
>
> For instance for gcc, the order is defined in gcc.cmake, and it is
> actually the correct order for gcc. AFAIK you simply need to reorder
> the option in whatever order your compiler want them...
>
> eg.:
>
> IF(CMAKE_COMPILER_IS_GNUCXX)
>  SET (CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC")   # -pic
>  SET (CMAKE_CXX_FLAGS_INIT "")
>  SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
>  SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
>  SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
>  SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
>  SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER>
> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
>  SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER>
> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
>  IF(NOT APPLE)
>    SET (CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")
>  ENDIF(NOT APPLE)
> ENDIF(CMAKE_COMPILER_IS_GNUCXX)
>
>
> HTH
> -Mathieu
>
> On Thu, Jun 12, 2008 at 1:09 PM, Benjamin Depardon
> <benjamin.depardon at ens-lyon.fr> wrote:
>> Hello,
>>
>> I'd like to know why does cmake add its compilation options (such  
>> as -o, or
>> some variable definitions) before the options contained in
>> CMAKE_language_FLAGS?
>> Is there a way to bypass this, and tell cmake to add its flags at  
>> the end of
>> the command line?
>> The problem is that I am using a compiler which requires options in a
>> certain order, and as cmake adds its own before the ones I defined,  
>> it
>> brokes the compilation.
>>
>> Thanks
>>
>> Ben
>>
>> ---------------------------
>> Benjamin Depardon
>>
>> Laboratoire de l'Informatique du Parallélisme (LIP) - Projet GRAAL
>> Ecole Normale Supérieure de Lyon
>> 46, allée d'Italie
>> 69364 Lyon Cedex 07 - France
>>
>> Tel: +33 (0)4 37 28 76 43
>>       +33 (0)6 84 08 31 55
>>
>> http://graal.ens-lyon.fr/~bdepardo
>> ---------------------------
>>
>> «Le réel possède un avantage considérable sur la fiction, c'est  
>> d'être
>> unique.»
>>   Raymond Depardon
>>
>> _______________________________________________
>> CMake mailing list
>> CMake at cmake.org
>> http://www.cmake.org/mailman/listinfo/cmake
>>
>
>
>
> -- 
> Mathieu

---------------------------
Benjamin Depardon

Laboratoire de l'Informatique du Parallélisme (LIP) - Projet GRAAL
Ecole Normale Supérieure de Lyon
46, allée d'Italie
69364 Lyon Cedex 07 - France

Tel: +33 (0)4 37 28 76 43
         +33 (0)6 84 08 31 55

http://graal.ens-lyon.fr/~bdepardo
---------------------------

«Le réel possède un avantage considérable sur la fiction, c’est d’être  
unique.»
     Raymond Depardon



More information about the CMake mailing list