Compiling a privateFont Application with cmake

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
OBueckert
In need of some credit
In need of some credit
Posts: 2
Joined: Wed Aug 25, 2021 7:24 pm

Compiling a privateFont Application with cmake

Post by OBueckert »

Hello,
I am trying to build a cross platform text editor with wxWidgets. I used cmake to statically compile wxWidgets and use cmake to compile my own application. I am using the wxPrivateFont system to integrate custom fonts. I have followed the "CMake Overview" tutorial for instruction. I build wxWidgets using:

Code: Select all

cmake ~/CLionProjects/Radon/dep/wxWidgets -DCMAKE_INSTALL_PREFIX=~/CLionProjects/Radon/dep/wxWidgets-build -DwxBUILD_SHARED=OFF
and

Code: Select all

cmake --build . --target install
My CMakeLists.txt file is pretty much:

Code: Select all

find_package(wxWidgets 3.1 COMPONENTS core base richtext adv html xml REQUIRED)

include(${wxWidgets_USE_FILE})

set(SRC_FILES
        src/Main.cpp
        src/App.cpp
        src/Main.h
        src/App.h
        )

# Define the build target for the executable
add_executable(${PROJECT_NAME} ${SRC_FILES})
# Link required libraries to the executable
target_link_libraries(${PROJECT_NAME} ${wxWidgets_LIBRARIES})
Everything seems to work fine until I try to compile my application. I get "error: ‘AddPrivateFont’ is not a member of ‘wxFont’".

I tried adding all wxWidgets components but that doesn't change anything. I've been stuck here for a few months now.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Compiling a privateFont Application with cmake

Post by doublemax »

Platform, wxWidgets version?

According to the docs, you need at least wx 3.1.1 for this method. If that requirement is met, wxUSE_PRIVATE_FONTS seems to be 0 when building your application. Try to find out why.

Maybe try building wxWidgets using the provided make files instead of using cmake.
Use the source, Luke!
OBueckert
In need of some credit
In need of some credit
Posts: 2
Joined: Wed Aug 25, 2021 7:24 pm

Re: Compiling a privateFont Application with cmake

Post by OBueckert »

I added the -DwxUSE_PRIVATE_FONTS=ON parameter to the wxWidgets build and rebuilt wxWidgets. My application now compiles without errors. Thank you very much for the help.
Post Reply