[cmake-developers] Unix Makefiles under MSys

Sean Farrell sean.farrell at rioki.org
Fri May 17 12:54:28 EDT 2013


I have MSys setup to behave mostly like a POSIX environment. I can build
most software (mostly libraries) using the "unix/linux" make steps. These
are 95% of the time the GNU triple jump. The actual software is then
packages using NSIS and installed as a mini, self contained, posix env.
(<instaldir>/bin, <instaldir>/share, etc.)

To do this my .profile looks like such:

export prefix=/usr/local

export CFLAGS="-I/usr/include -I/usr/local/include"
export CPPFLAGS=$CFLAGS
export CXXFLAGS=$CFLAGS

export CXX="g++ -std=c++0x"

export LDFLAGS="-L/usr/lib -L/usr/local/lib"

In my experience, this a very painless approach to handling third party
libraries. Most libraries have well defined makefiles and their "standard"
windows build is odd defined vcproj at best. This approach combines
building "proper" native win32 binaries with the well defined nature of
standard POSIX build environment. In addition, I can target the three big
PC platforms with one set of makefiles (actually pure makefiles for most of
my projects) with only minimal platform specifics.

The only time this breaks down is when some package tries to be smart about
it and do things differently, since it is on windows.

The "standard" behavior of makefiles it to respect the prefix (on some
platforms PREFIX) and DESTDIR environment variables and install into
$DESTDIR/$prefix. For example you would run make like such "make install
prefix=/opt" to install something into /opt. For example configure
(autoconf) captures these variables and uses them, but you can
also specify them per make invocation. cmake neither respects the variables
nor emits makefiles that respect the variables. As such they are not
"standard Unix makefiles".

This entire thing is basically just confusing. The obvious workaround is to
call cmake with -DCMAKE_INSTALL_PREFIX:PATH=/usr/local. It would be nice if
the behavior would be in line with real Unix makefiles. As a middle ground,
the default could still fallback on %ProgramFiles% if the variables are not
set.

Sean


On Fri, May 17, 2013 at 5:16 PM, Bill Hoffman <bill.hoffman at kitware.com>wrote:

> On 5/17/2013 10:52 AM, Sean Farrell wrote:
>
>> Brad, I can see the reasoning, except for the fact that cmake completely
>> ignores the settings and environment variables relevant to the selected
>> toolchain. Respecting the prefix variable, would be the
>> minimal concession to "Unix".
>>
>>  What environment variables are you talking about?
>
>
>  Bill, "MinGW Makefiles" is useless, since it is even more windows, since
>> it use cmd.exe and mingw32-make.exe. That is ok, since that is what a
>> vanilla MinGW environment is. MSYS Makefiles is basically identical to
>> Unix Makefiles, so I see no difference (as seen from the outside).
>>
>>  MinGW and MSYS work well with those compilers and versions of gmake that
> come with MinGW and MSYS.    MSYS Makefiles are not identical to Unix
> Makefiles, mostly due to the paths internally.
>
> What is your use case?   What are you trying to do?
>
> -Bill
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20130517/831da869/attachment.html>


More information about the cmake-developers mailing list