[Fontconfig] CMakeLists.txt for fontconfig library (enables native compilation on windows)

Pavel Koshevoy pkoshevoy at gmail.com
Sun Oct 7 16:15:10 PDT 2012

On 10/7/12 7:18 AM, Akira TAGOH wrote:
> First, AFAIK no one tried to build fontconfig for native build on
> MSVC. as other projects has own Makefile for that and we don't have,
> I'm not so surprised you got a problem then. also if you see any
> problems in the code, you are welcome to contribute a patch to
> fix/improve something for Win32 as other people has been done until
> now. and I'm assuming that fontconfig can be built with mingw and
> cygwin. if there are any problems, please file a bug.
> That said I'm a bit concerned to import any cmake files into git,
> because, though I learned cmake in other project recently, I didn't
> feel any advantages compared to autotools. so I'm not planning to move

I am not proposing to switch to cmake for any platforms.  I am only 
proposing to make it available for native win32/win64 builds.  If 
someone decides to extend it later to more platforms -- great, but that 
was not my focus this time.

> to cmake for fontconfig so far; assuming that, as cmake supports some
> platforms and architectures, one may presume it may works instead of
> autotools. it may be out of date eventually.

Well, if it goes out of date then the next time someone needs to use it 
-- it will be their responsibility to bring it up to date.  I am not 
proposing to burden a predominantly Linux based project to support 
native compilation on Windows.  I am just trying to make it easier for 
Windows developers to use fontconfig on their platform. BTW, one of the 
projects required by fontconfig also provides CMakeLists.txt in addition 
to autotools configuration -- expat-2.1.0.  So, this isn't unprecedented.

A cmake file is certainly easier to maintain than a Visual Studio 
solution+project (which is what some other open source projects 
occasionally provide). However, as I've already said -- you don't need 
to maintain it, let those who use it maintain it.

> Anyway, I'm a bit opposed to importing it into git because you have
> omitted the explanation why you ended up to write it instead of
> patching out autotools files. I'm not so familiar with Win32 so I may
> be missing something else.

I know nothing about autotools, except how to run ./configure --help.  I 
am not qualified to make changes to autotools configuration files.

I do know a little about cmake because of my work with ITK a few years 
ago, and because I use it for a few of my cross-platform projects.

The reason I needed to do this port was because I was seeing a strange 
crash with mingw build of fontconfig when linked to a msvc build of my 
application.  I couldn't debug it in Visual Studio because it doesn't 
support gcc compiled code.  After I recompiled fontconfig using MSVC the 
crash had disappeared.

I suspect the crash had something to do with these linker warnings:
> 2>------ Build started: Project: apprenticevideo, Configuration: 
> RelWithDebInfo Win32 ------
> 2>libfontconfig.a(fccfg.o) : warning LNK4229: invalid directive 
> '/aligncomm:__fcConfig,2' encountered; ignored
> 2>libfontconfig.a(fcdbg.o) : warning LNK4229: invalid directive 
> '/aligncomm:_FcDebugVal,2' encountered; ignored
> 2>   Creating library 
> C:\Developer\x86\build\apprenticevideo\RelWithDebInfo\apprenticevideo.lib 
> and object 
> C:\Developer\x86\build\apprenticevideo\RelWithDebInfo\apprenticevideo.exp
> 2>Generating code
> 2>Finished generating code
> 2>Embedding manifest...

Unfortunately, I can not reproduce the crash any longer, even after I 
revert my changes and rebuild fontconfig/freetype/expat with mingw.

I still think having a cmake project would be valuable at least to 
windows developers.


More information about the Fontconfig mailing list