utelle/wxchartdir

What's the proper way to include this into my cmake project?

Sammyalhashe opened this issue · 2 comments

I have managed to run it by hacking something together in which I clone the repo into my include directory and include the file I need like:

#include  <wxchartdir/include/bchartdir.h>
// etc...

I did this by setting CMAKE_PREFIX_PATH to look for the shared object file in ./include/wxchartdir/lib/linux64. I also had to include the build object file wxchartviewer.o manually.

This wasn't enough for me as I also had to manually change some of the includes in wxchartviewer.h. I have it working, but I was wondering if there is an easier way for me to do this. My cmake-fu isn't that great to be honest and a lot of the installation docs seemed to be geared towards windows builds.

Needless to say obviously I'm going about this the wrong way and this is not sustainable. Any tips on how I can proceed?

Actually, I have literally no experience with cmake myself. However, the library manager vcpkg uses cmake under the hood and a vcpkg wxChartDir package as well as a vcpkg ChartDirector package are available. Maybe that can help you to find out how to proceed.

The wxChartViewer component itself consists of just a couple of source files, all located in wxchartdir/wxdemo/common.
The compiler needs to be able to find the relevant include files, so adding options -Iwxchartdir/wxdemo/common and -Iwxchartdir/include is necessary. The linker needs to be able to locate the relevant libraries, so adding option -lwxchartviewer and -lchartdir will be necessary; additionally options for the library paths are required, i.e. -Lwxchartdir/lib/linux64.

Thanks for those links, gave me better ideas. I ended up just including it as a submodule and linking the required things as you stated.