← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] expat dependency for cmake

 

> 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)

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

Best Regards,

Brian.



Follow ups

References