mirror of
https://github.com/dhewm/dhewm3-sdk.git
synced 2024-11-28 15:22:27 +00:00
cmake: Use GNUInstallDirs
Provides configure style overwritable path settings. Include a fallback for cmake versions without GNUInstallDirs.
This commit is contained in:
parent
95c34a8a00
commit
a3456b9004
1 changed files with 31 additions and 15 deletions
|
@ -22,6 +22,7 @@ set(CMAKE_SKIP_RPATH ON CACHE BOOL "Skip RPATH" FORCE)
|
||||||
|
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
include(CheckFunctionExists)
|
include(CheckFunctionExists)
|
||||||
|
include(GNUInstallDirs OPTIONAL RESULT_VARIABLE GNUINSTALLDIRS)
|
||||||
|
|
||||||
option(CORE "Build the core" ON)
|
option(CORE "Build the core" ON)
|
||||||
option(BASE "Build the base game code" ON)
|
option(BASE "Build the base game code" ON)
|
||||||
|
@ -229,23 +230,31 @@ if (WIN32)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (APPLE)
|
# fallback for cmake versions without GNUInstallDirs
|
||||||
SET(bindir "${CMAKE_INSTALL_PREFIX}")
|
if(GNUINSTALLDIRS MATCHES "NOTFOUND")
|
||||||
SET(libdir "${CMAKE_INSTALL_PREFIX}")
|
set(CMAKE_INSTALL_BINDIR "bin"
|
||||||
SET(datarootdir "${CMAKE_INSTALL_PREFIX}")
|
CACHE PATH "user executables (bin)")
|
||||||
SET(datadir "${datarootdir}")
|
set(CMAKE_INSTALL_LIBDIR "lib${LIB_SUFFIX}"
|
||||||
elseif (WIN32)
|
CACHE PATH "object code libraries (lib${LIB_SUFFIX})")
|
||||||
SET(bindir "${CMAKE_INSTALL_PREFIX}")
|
set(CMAKE_INSTALL_DATAROOTDIR "share"
|
||||||
SET(libdir "${CMAKE_INSTALL_PREFIX}/lib")
|
CACHE PATH "read-only architecture-independent data root (share)")
|
||||||
SET(datarootdir "${CMAKE_INSTALL_PREFIX}")
|
set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}"
|
||||||
SET(datadir "${datarootdir}")
|
CACHE PATH "read-only architecture-independent data (DATAROOTDIR)")
|
||||||
else()
|
|
||||||
SET(bindir "${CMAKE_INSTALL_PREFIX}/bin")
|
mark_as_advanced(CMAKE_INSTALL_BINDIR CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_DATAROOTDIR CMAKE_INSTALL_DATADIR)
|
||||||
SET(libdir "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/dhewm3")
|
foreach(dir BINDIR LIBDIR DATAROOTDIR DATADIR)
|
||||||
SET(datarootdir "${CMAKE_INSTALL_PREFIX}/share")
|
if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
|
||||||
SET(datadir "${datarootdir}/dhewm3")
|
set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
|
||||||
|
else()
|
||||||
|
set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(bindir "${CMAKE_INSTALL_FULL_BINDIR}")
|
||||||
|
set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}/dhewm3")
|
||||||
|
set(datadir "${CMAKE_INSTALL_FULL_DATADIR}/dhewm3")
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
"${CMAKE_SOURCE_DIR}/config.h.in"
|
"${CMAKE_SOURCE_DIR}/config.h.in"
|
||||||
"${CMAKE_BINARY_DIR}/config.h"
|
"${CMAKE_BINARY_DIR}/config.h"
|
||||||
|
@ -253,6 +262,13 @@ configure_file(
|
||||||
|
|
||||||
message(STATUS "Building ${CMAKE_BUILD_TYPE} for ${os}-${cpu}")
|
message(STATUS "Building ${CMAKE_BUILD_TYPE} for ${os}-${cpu}")
|
||||||
|
|
||||||
|
if (NOT APPLE AND NOT WIN32)
|
||||||
|
message(STATUS "The install target will use the following directories:")
|
||||||
|
message(STATUS " Binary directory: ${bindir}")
|
||||||
|
message(STATUS " Library directory: ${libdir}")
|
||||||
|
message(STATUS " Data directory: ${datadir}")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(src_renderer
|
set(src_renderer
|
||||||
renderer/jpeg_memory_src.cpp
|
renderer/jpeg_memory_src.cpp
|
||||||
renderer/Cinematic.cpp
|
renderer/Cinematic.cpp
|
||||||
|
|
Loading…
Reference in a new issue