← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] expat dependency for cmake

 

Hi Brian, 

On Oct 15, 2010, at 11:37 AM, Brian Sidebotham wrote:

>> I already had a suspicion my patch was not complete.
>> I was hoping to achieve that cmake does all the dependency checks and then decides if there is enough to build it or to ask for other dependencies, instead of finding out at linking-time.
>> 
>> 
>> Probably we need to do the wxWidgets check before the expat check, right?
>> 
>> So the patch should to the following (?):
>> # only gl and mono can be detected
>> find_package(wxWidgets COMPONENTS mono gl REQUIRED)
>> if(NOT WIN32)
>>        find_package(wxWidgets COMPONENTS gl adv html core net base xml REQUIRED)
>> endif(NOT WIN32)
>> 
>> but how can we check for (wx)expat and if that fails look for (sys)expat? if wxWidgets cannot find wxexpat it should look for the system one with find_package...and add the linker flag -lexpat
>> 
>> These changes are tricky, since cmake behaves different on linux/win/osx, but with a little help I am sure we can work it out. Also, if building a deb-package you probably do not want the static linked version, but one with dependencies on the other packages, but I have not looked into that yet.
> 
> Hi Martijn,
> 
> I think the type of check you need is something like: (psuedo code)
> 
> check (wxWidgets COMPONENTS expat QUIET)
> if (NOT wxWidgets_FOUND)
>    check (expat QUIET)
>    if(expat_FOUND)
>        add_link_library(expat)
>    else(expat_FOUND)
>        print "Neither wxWidgets expat, or sys expat found"
>        check_find_package_result(expat)
>    endif(expat_FOUND)
> endif(NOT wxWidgets_FOUND)

Will this work for Windows? Can windows find expat components of wxWidgets? 
> 
> ...
> (carry on with std wxWidgets checks)
> ...
> 
> Something along those lines anyway I guess. If you struggle and just
> want a patch made, let me know. I could have a look at it when I get
> home for work tonight.

I am not in the position to ask for a patch, since I cannot commit it. I think it would make it easier to build kicad from source if there is a clear indication of the dependencies when building. It's easy to install expat if cmakes tells you it is needed, it is more difficult to figure out if the building process errors out with a lot of linker errors, usually after 80% of the work. 

I think such a patch would be worthwhile. It would have made it easier for me to compile kicad on my machine.
Whether such a patch would be accepted by the committing devs, I don't know, but I don't see why they would oppose. 

Kind regards,
Martijn

> 
> Best Regards,
> 
> Brian.




References