Skip to content

Commit

Permalink
Add CMake option for XDG directories
Browse files Browse the repository at this point in the history
  • Loading branch information
sparr authored and olanti-p committed Oct 17, 2023
1 parent 9a20248 commit 12d09c5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ option(SOUND "Support for in-game sounds & music." "OFF")
option(LUA "Support for in-game scripting with Lua." "OFF")
option(BACKTRACE "Support for printing stack backtraces on crash" "ON")
option(LIBBACKTRACE "Print backtrace with libbacktrace." "OFF")
option(USE_HOME_DIR "Use user's home directory for save files." "ON")
option(USE_XDG_DIR "Use XDG directories for save and config files." "OFF")
option(USE_HOME_DIR "Use user's home directory for save and config files." "ON")
option(USE_PREFIX_DATA_DIR "Use UNIX system directories for game data in release build." "ON")
set(LANGUAGES
""
Expand Down Expand Up @@ -213,6 +214,11 @@ if (TILES)
set(CURSES OFF)
endif ()

# Can't use both home and xdg directories
if (USE_XDG_DIR)
set(USE_HOME_DIR OFF)
endif ()

# Set build types and display info
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(RELEASE 0)
Expand Down Expand Up @@ -260,6 +266,7 @@ message(STATUS "LUA : ${LUA}")
message(STATUS "BACKTRACE : ${BACKTRACE}")
message(STATUS "LIBBACKTRACE : ${LIBBACKTRACE}")
message(STATUS "USE_HOME_DIR : ${USE_HOME_DIR}\n")
message(STATUS "USE_XDG_DIR : ${USE_XDG_DIR}")

message(STATUS "UNITY_BUILD : ${USE_UNITY_BUILD}")
message(STATUS "PCH_HEADER : ${USE_PCH_HEADER}")
Expand Down Expand Up @@ -449,6 +456,10 @@ if (USE_HOME_DIR)
add_definitions(-DUSE_HOME_DIR)
endif ()

if (USE_XDG_DIR)
add_definitions(-DUSE_XDG_DIR)
endif ()

find_program(CCACHE_FOUND ccache)
if (CCACHE_FOUND AND CATA_CCACHE)
set(CMAKE_C_COMPILER_LAUNCHER ccache)
Expand Down

0 comments on commit 12d09c5

Please sign in to comment.