[CMake] Using mingw from cygwin terminal (/cygwin directory problems)

Chiheng Xu chiheng.xu at gmail.com
Thu Sep 2 01:02:55 EDT 2010


On Tue, Aug 31, 2010 at 3:48 PM, Mike McQuaid <mike at mikemcquaid.com> wrote:
>
> On 31 Aug 2010, at 08:44, Tam Toucan wrote:
>
>> I am using cmake cygwin. Is there something I need to do to get it to
>> generate makefiles that are compatible with mingw32? The problem is that
>> the makefile contains an absolute path to all sources that is only
>> visible to cygwin programs. i.e. the command line ends up as
>>
>>       mingw32-g++ /home/Tam/src/foo.C
>>
>> but that only works for (cygwin) g++, mingw32-g++ knows nothing about
>> the absolute (cygwin) path. So some way to either; generate different
>> makefiles, change the <target>_SOURCES list of files to put /cygwin in
>> front of each (seems hacky) or not use absolute paths (as per
>> auto-tools).
>
>
> I just reread this. You need to use cmake _not_ for cygwin (i.e. normal Windows binary) if you want non-cygwin paths in your makefiles and cmake for cygwin if you want to use cygwin paths in your makefiles.
>
> Basically, your options are using the version of mingw provided with cygwin or using the CMake Windows version and remembering to specify mingw-make as the generator from the GUI.
>

Cygwin has API to translate POSIX path to Win32 path:
http://cygwin.com/cygwin-api/func-cygwin-conv-path.html

Cygwin port of CMake can feed the compiler (Cygwin GCC, MinGW GCC,
MSVC) with Win32 absolute path.  Then you can let Cygwin make to work
well with all Windows compilers.




-- 
Chiheng Xu
Wuhan,China


More information about the CMake mailing list