1
0
Fork 0

CMake changes related to FGDATA_SRC_DIR and TRANSLATIONS_SRC_DIR

- When FGDATA_SRC_DIR isn't explicitly set by the user, set it to
  ${PROJECT_SOURCE_DIR}/../fgdata if this is a directory.

- When TRANSLATIONS_SRC_DIR isn't explicitly set by the user, look for
  translations in ${FGDATA_SRC_DIR}/Translations instead of
  ${PROJECT_SOURCE_DIR}/../fgdata/Translations (i.e., honor the setting
  of FGDATA_SRC_DIR for the sake of translation lookup).

This fixes the problem explained in [1] and [2].

[1] https://sourceforge.net/p/flightgear/mailman/message/36645499/
[2] b2274fbbed/
This commit is contained in:
Florent Rougon 2019-04-25 18:45:52 +02:00
parent b83c069b0b
commit b2d6acdd4d
2 changed files with 9 additions and 6 deletions

View file

@ -57,6 +57,9 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment ver
project(FlightGear)
# Define SRC_PARENT_DIR as the parent directory of the project source directory
get_filename_component(SRC_PARENT_DIR ${PROJECT_SOURCE_DIR} DIRECTORY)
# We have some custom .cmake scripts not in the official distribution.
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
@ -94,6 +97,9 @@ include( ConfigureCPack )
# FlightGear base package path
if (FG_DATA_DIR)
message(STATUS "Using explicit data directory for base package: ${FG_DATA_DIR}")
elseif(IS_DIRECTORY "${SRC_PARENT_DIR}/fgdata")
set(FG_DATA_DIR "${SRC_PARENT_DIR}/fgdata")
message(STATUS "Using data directory for base package: ${FG_DATA_DIR}")
else()
set(FG_DATA_DIR "${CMAKE_INSTALL_PREFIX}/lib/FlightGear" CACHE PATH "Default location where data files are located")
message(STATUS "Using default data directory for base package: ${FG_DATA_DIR}")

View file

@ -1,15 +1,12 @@
GET_FILENAME_COMPONENT(SRC_PARENT_DIR ${PROJECT_SOURCE_DIR} PATH)
SET(FGDATA_SRC_DIR "${SRC_PARENT_DIR}/fgdata")
set(xlf_file "en_US/FlightGear-Qt.xlf")
if(EXISTS "${TRANSLATIONS_SRC_DIR}/${xlf_file}")
message(STATUS "Using explicitly defined translations from: ${TRANSLATIONS_SRC_DIR}")
set(do_translate TRUE)
elseif(EXISTS "${FGDATA_SRC_DIR}/Translations/${xlf_file}")
SET(TRANSLATIONS_SRC_DIR "${FGDATA_SRC_DIR}/Translations")
message(STATUS "Found translations dir implicitly: ${TRANSLATIONS_SRC_DIR}")
elseif(EXISTS "${FG_DATA_DIR}/Translations/${xlf_file}")
set(TRANSLATIONS_SRC_DIR "${FG_DATA_DIR}/Translations")
set(do_translate TRUE)
message(STATUS "Found translations dir implicitly: ${TRANSLATIONS_SRC_DIR}")
else()
message(STATUS "Couldn't find translations data, will not include translated string in the executable")
set(do_translate FALSE)