From 3f02146f870f6197d188b2e540e868b17a5a682a Mon Sep 17 00:00:00 2001 From: Hennadii Chernyshchyk Date: Fri, 16 Dec 2022 11:39:32 +0200 Subject: [PATCH] Use different add_definitions for ENABLE_MONOLITHIC_INSTALL --- CMakeLists.txt | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d325ba04..64f00943c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -390,22 +390,27 @@ else() set(BIN_DIR "." CACHE STRING "Where to install binaries") set(LIB_DIR "." CACHE STRING "Where to install main library") set(DATA_DIR "." CACHE STRING "Where to install data files") + + # following constants only used for platforms using XDG (Linux, BSD, etc) + add_definitions(-DM_DATA_DIR="${DATA_DIR}") + add_definitions(-DM_BIN_DIR="${BIN_DIR}") + add_definitions(-DM_LIB_DIR="${LIB_DIR}") else() if(NOT BIN_DIR) - set(BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE STRING "Where to install binaries") + set(BIN_DIR "bin" CACHE STRING "Where to install binaries") endif() if(NOT LIB_DIR) - set(LIB_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/vcmi" CACHE STRING "Where to install main library") + set(LIB_DIR "${CMAKE_INSTALL_LIBDIR}/vcmi" CACHE STRING "Where to install main library") endif() if(NOT DATA_DIR) - set(DATA_DIR "${CMAKE_INSTALL_PREFIX}/share/vcmi" CACHE STRING "Where to install data files") + set(DATA_DIR "share/vcmi" CACHE STRING "Where to install data files") endif() - endif() - # following constants only used for platforms using XDG (Linux, BSD, etc) - add_definitions(-DM_DATA_DIR="${DATA_DIR}") - add_definitions(-DM_BIN_DIR="${BIN_DIR}") - add_definitions(-DM_LIB_DIR="${LIB_DIR}") + # following constants only used for platforms using XDG (Linux, BSD, etc) + add_definitions(-DM_DATA_DIR="${CMAKE_INSTALL_PREFIX}/${DATA_DIR}") + add_definitions(-DM_BIN_DIR="${CMAKE_INSTALL_PREFIX}/${BIN_DIR}") + add_definitions(-DM_LIB_DIR="${CMAKE_INSTALL_PREFIX}/${LIB_DIR}") + endif() endif() # iOS has flat libs directory structure