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

2010-09-01 Thread Chiheng Xu
On Tue, Aug 31, 2010 at 3:48 PM, Mike McQuaid  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 _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
___
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

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

2010-08-31 Thread Mike McQuaid

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 _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.

--
Cheers,
Mike McQuaid
http://mikemcquaid.com

___
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


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

2010-08-31 Thread Mike McQuaid

On 30 Aug 2010, at 20:14, Tam Toucan wrote:

> Hi,
>   I've just started converting my projects from autotools to CMake and I've 
> hit a simple problem. I want to compile from a cygwin terminal, but using 
> mingw32 (cygwin gcc has removed the -mno-cygwin option). I'm using
> 
> SET(CMAKE_CXX_COMPILER "mingw32-g++")
> FILE(GLOB foo_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.C)
> ADD_LIBRARY(foo STATIC ${foo_SOURCES})
> 
> but that tries to compile the source at an absolute path of
> 
>   /home/Tam/src/foo.C
> 
> but mingw can't see that directory since from a windows point of view the 
> source is
> 
>/cygwin/home/Tam/src/foo.C
> 
> how should I be doing this? I thought I'd just try it from a Windoze command 
> window (just to see if I could get it working, but I really don't want to 
> have to use it), but when I run cmake is still picks up /usr/bin/c++.exe at 
> the default and tries to compile using /home for all the paths.

To do this you need to use a version of CMake compiled in Cygwin. I'm pretty 
sure a binary package is available in the package manager.

--
Cheers,
Mike McQuaid
http://mikemcquaid.com

___
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