[Cmake] Determining host compiler/OS from CMake

Bill Hoffman bill.hoffman at kitware.com
Mon Mar 4 14:16:16 EST 2002


I have just added per file flags with the command:

SOURCE_FILES_FLAGS("-Dfoobar" file1 file2 ...)



At 05:37 PM 3/1/2002 +0000, Ian Scott wrote:
>I don't know how useful adding detailed compiler support to CMakeLists.txt
>is.
>Either your compiler options are the default ones set by cmake, or you can
>set them manually.
>
>Where I do think there is a problem is the inability to set options for
>single .cxx file. I have a file in VXL that doesn't compile properly with
>gcc 2.95. The problem is exhibited in a subtle lack of IEEE rounding
>conformity. I can use some of gcc's -f options to fiddle with the code out
>and make it go away. These options have performance implications and so I
>only want to run them for one file.
>Currently I run the compiler by hand over that file, and then set it read
>only, so that I don;t accidently compile over it.
>My ideal solution (short of getting a better compiler) would be to modify
>the relevant CMakeLists.txt file so that it included an optional
>CMakeListsLocal.txt file. I could then check the CMakeLists.txt file into
>the VXL repository. My CMakeListsLocal.txt file would contain an option to
>modify the compiler options on my problematic .cxx file.
>
>I don't plan to implement this :-(
>
>Ian.
>
>> -----Original Message-----
>> From: Andy Cedilnik [mailto:Andy.Cedilnik at kitware.com]
>> Sent: Thursday, February 28, 2002 5:15 PM
>> To: Bill Hoffman; Parag Chandra; cmake at public.kitware.com
>> Subject: Re: [Cmake] Determining host compiler/OS from CMake
>>
>>
>> At 11:53 AM 2/28/2002 -0500, Bill Hoffman wrote:
>> >Short answer: No, currently there is not.
>> >
>> >>Is there a predefined Cmake variable that I can use to
>> determine the
>> >>compiler and/or the operating system that Cmake is running
>> under? I d
>> >>like Cmake to be able to set some flags via the
>> ADD_DEFINITIONS command
>> >>using this information.
>>
>> Not to want to start the flame fights, but it may be a good
>> idea to add
>> some minimal support for getting compiler information in CMake.
>> I mean, you can always do things in your C files and determine
>> what compiler it is, but we could have something like:
>> CMAKE_CXX_COMPILER_TYPE, which would say something like
>> gcc,  hpux-aCC,  msvc, or bcc. This way developer could do some
>> tricks inside CMake versus inside source files.
>>
>> There is a "hacky" way of determining certain things already. For
>> example you can say IF(BORLAND) for borland or IF(WIN32) IF(UNIX)
>> for cygwin and so on.
>>
>> So, simple mechanism for describing compiler and platform:
>>
>> COMPILER_TYPE=gcc
>> COMPILE_PLATFORM=win32
>> = cygwin
>>
>> Comments?
>>
>>                          Andy
>>
>> _______________________________________________
>> Cmake mailing list
>> Cmake at public.kitware.com
>> http://public.kitware.com/mailman/listinfo/cmake
>>
>
>_______________________________________________
>Cmake mailing list
>Cmake at public.kitware.com
>http://public.kitware.com/mailman/listinfo/cmake 




More information about the CMake mailing list