Merge pull request #805 from shenlebantongying/fix_cmake_datadir

fix: define PROGRAM_DATA_DIR for cmake
This commit is contained in:
xiaoyifang 2023-06-03 23:30:24 +08:00 committed by GitHub
commit 4fc21074ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -95,6 +95,11 @@ endif ()
# Note: used as c++ string thus need surrounding " "
add_compile_definitions(PROGRAM_VERSION="${PROJECT_VERSION}")
if (LINUX)
# see: config.cc -> getProgramDataDir
add_compile_definitions(PROGRAM_DATA_DIR="${CMAKE_INSTALL_PREFIX}/share/goldendict")
endif ()
target_link_libraries(${GOLDENDICT} PRIVATE
Qt6::Xml
Qt6::Concurrent

View file

@ -2276,7 +2276,7 @@ QString getProgramDataDir() noexcept
{
if ( isPortableVersion() )
return QCoreApplication::applicationDirPath();
// TODO: rewrite this in QStandardPaths::AppDataLocation
#ifdef PROGRAM_DATA_DIR
return PROGRAM_DATA_DIR;
#else