including pdfDoc into cmmake project build

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Post Reply
EddieM
Experienced Solver
Experienced Solver
Posts: 81
Joined: Mon Oct 19, 2020 3:27 pm

including pdfDoc into cmmake project build

Post by EddieM »

I think this question boils down to a cmake question. I am writing a wxWidget app and have decided i want pdf output.
At this milestone I decided to upgrade/update everything. So I loaded wxWidgets 3.2.1 from github and build/install:

Code: Select all

    mkdir build_gtk
    cd build_gtk
    ../configure
    make
    su <type root password>
    make install
    ldconfig
My app still builds and works.
I loaded wxPdfDoc from github and used the same commands in that directory to build. That builds and installs.
I'm using VSCode with cmake for my project. Here is the pertinent cmake code:

Code: Select all

find_package( wxWidgets COMPONENTS core base xml pdfdoc REQUIRED )

set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${build_Directory} )

include( "${wxWidgets_USE_FILE}" )

include_directories(  ${StampTool_Source_Directory} 
${AlbumGen_GuiFiles_Source_Directory}
${AlbumGen_UtilsFiles_Source_Directory}
${AlbumGen_ODTFiles_Source_Directory}
${AlbumGen_DesignFiles_Source_Directory}
${AlbumGen_CatalogFiles_Source_Directory} ${WXWIN} )

add_subdirectory (utils)
add_subdirectory (gui)
add_subdirectory (catalog)
add_subdirectory (design)
add_subdirectory (odt)

add_executable ( StampTool 
    StampToolApp.cpp
    Defs.cpp
)

target_link_libraries (StampTool LINK_PUBLIC 
     GuiFiles  
    DesignFiles
    CatalogFiles  
    ODTFiles    
    Utils
    ${wxWidgets_LIBRARIES}
    )
Just as a test i #include <wx/pdfdocument.h> and instantiated a wxPdfDocument in a file.
It compiles so the include paths are ok but barfs on finding the pdf lib.

Code: Select all

...
[build] [ 96%] Linking CXX shared library libGuiFiles.so
[build] [ 96%] Built target GuiFiles
[build] make[2]: *** No rule to make target '/usr/local/lib/libwx_gtk3u_pdfdoc-3.2.a', needed by 'StampTool'.  Stop.
[build] make[2]: *** Waiting for unfinished jobs....
Note I added pdfdoc into the findpackage line of the cmake file. I tried a couple of variations including another find package line for wxcode.

The local libs I build are shared but i believe the .a is i believe a static lib. Also there is a /usr/local/lib/libwxcode_gtk3u_pdfdoc-3.2.a as well as a couple of others.
I feel like I'm close but can't quite figure out what I need to do.
How do I tell cmake what the right lib is?
Thanks,
Eddie
The most wasted of all days is one without laughter.
~e.e. cummings.
EddieM
Experienced Solver
Experienced Solver
Posts: 81
Joined: Mon Oct 19, 2020 3:27 pm

Re: including pdfDoc into cmmake project build

Post by EddieM »

Well. I'm not above trying stuff, even when I don't know what I'm doing...
And this may be an easier question...
I went int the config file and changed a line where it looks like it was building WXPDFDOC_LIBNAME. i changed
"wxcode" to "wx", did a "make distclean" and rebuilt. It now compiles and links. Its time to see if I can make a pdf.
I don't know diddly about make/config/etc. I want to use cmake because I'm eventually going to MSW to build and want a common process.
Is what i did ok or have I done a bad thing?
thanks,Eddie
The most wasted of all days is one without laughter.
~e.e. cummings.
Post Reply