[Cmake] Cross-compiling

Bill Hoffman bill.hoffman at kitware.com
Wed Dec 11 14:31:36 EST 2002


At 02:17 PM 12/11/2002 -0500, Mathieu Mazerolle wrote:
>Hi William,
>
>In our case, nmake and unix make file generators are less interesting since
>they seem to pollute the source tree with make files: we would like
>something self-contained, with one make file for the whole project in one
>directory. I think it's the achilles heel of gnu make (and nmake) that they
>can't seem to do dependencies in a sensible way without including zillions
>of sub-make files.

CMake does not have to "pollute" the source tree.  One of the features of 
CMake is that it supports out-of-source builds.   So, if you select a different
build directory than your source directory, all the makefiles or visual studio 
files are outside of your source tree, and can be removed without danger of removing
actual source code.


>As well, I think the Unix makefile generator should be enabled on Windows:
>the NMake one derives from it anyways, so why remove it? Actually, makefile
>generators should have no dependency on a particular platform: they're just
>writing text. This would save CMake from 99% of its conditional compilation
>macros.

In the next version of cmake, this may be possible.   I will have a look.
In cmake 1.4, for unix cmake used a configure script to determine how to use
the compiler and how to build shared, static libraries, and several other things.
To run the configure script from the windows GUI, you would have to have cygwin in
your windows path which most do not have.    Also, there is the issue of path 
separators, / or \.    


>We'll probably wind up writing a custom makefile generator: many of the
>basic elements of CMake seem to be very well made, such as dependency
>checking, command structure, etc. However, I find the makefiles that get
>created by the default generators to be a bit too heavy-handed for our
>project.

I think you will find if you add dependency checking, and sub directories, you will
find that over time you will end up with the same sort of makefiles.   To do dependency
checking with make, you have to recursively call make and use separate files.

>Thanks for your suggestion, btw.
>-- Matt
>
>
>----- Original Message -----
>From: "William A. Hoffman" <bill.hoffman at kitware.com>
>To: "Mathieu Mazerolle" <mathieu_mazerolle at hotmail.com>;
><cmake at public.kitware.com>
>Sent: Tuesday, December 10, 2002 10:36 PM
>Subject: Re: [Cmake] Cross-compiling
>
>
>>
>> You can generate NMake files from the CMakeSetup.  However,
>> the current version of cmake requires that a configure script be run
>> to set up the c and C++ compilers.   This can not be done from the
>> windows GUI without cygwin in the path.   In the next version, this
>> will become a bit easier as we no longer use a configure script, and
>> cmake supports trycompile and tryrun.     However, it will still want to
>> run the compiler.
>>
>> -Bill
>>
>>
>> At 06:47 PM 12/10/2002 -0500, Mathieu Mazerolle wrote:
>> >Hello,
>> >I'm attempting to use cmake in a cross-compiling environment. Is there
>any
>> >good reason why I can't use the windows gui (CMakeSetup) to generate Unix
>> >makefiles? The code seems to be a mess of #ifdefs for Cygwin vs. Win32,
>and
>> >I'm not sure this is going to make the job any easier. For example, why
>does
>> >CMake assume that just because I'm running the program on windows that I
>> >wanr WIN32 defined for my generated files?
>> >
>> >-- Matt
>> >_______________________________________________
>> >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
>>
>_______________________________________________
>Cmake mailing list
>Cmake at public.kitware.com
>http://public.kitware.com/mailman/listinfo/cmake 






More information about the CMake mailing list