2025-01-14 02:31:39 +01:00
|
|
|
cmake_minimum_required(VERSION 3.14)
|
2025-01-06 23:58:05 +01:00
|
|
|
project(speed-dreams-data LANGUAGES NONE VERSION 2.3.0)
|
2025-01-14 02:31:39 +01:00
|
|
|
|
|
|
|
# Because of this being a pure CMake project (i.e., no languages),
|
|
|
|
# this might cause a warning message from CMake since CMAKE_INSTALL_LIBDIR
|
|
|
|
# cannot be determined. Instead, ${CMAKE_INSTALL_PREFIX}/lib will be used,
|
|
|
|
# since this is assumed as safe.
|
|
|
|
# Further reference:
|
|
|
|
# https://gitlab.kitware.com/cmake/cmake/-/issues/23461
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
|
|
|
set(datadir ${CMAKE_INSTALL_DATADIR}/games/speed-dreams-2 CACHE PATH
|
|
|
|
"Place where all the static data files should go")
|
|
|
|
|
2025-01-16 06:18:42 +01:00
|
|
|
execute_process(
|
|
|
|
COMMAND git describe --tags --dirty
|
|
|
|
RESULT_VARIABLE result
|
|
|
|
OUTPUT_VARIABLE version
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
|
|
|
|
|
|
|
if(result EQUAL 0)
|
|
|
|
string(FIND "${version}" "-" index)
|
|
|
|
|
|
|
|
if(NOT ${index} EQUAL -1)
|
|
|
|
string(SUBSTRING ${version} ${index} -1 CMAKE_PROJECT_VERSION_TWEAK)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2025-01-14 02:31:39 +01:00
|
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
|
|
|
|
configure_package_config_file(
|
|
|
|
cmake/${PROJECT_NAME}.cmake.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
|
2025-01-13 21:48:49 +01:00
|
|
|
INSTALL_DESTINATION lib/cmake/${PROJECT_NAME}
|
2025-01-14 02:31:39 +01:00
|
|
|
PATH_VARS datadir
|
|
|
|
)
|
|
|
|
|
|
|
|
write_basic_package_version_file(
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
|
|
|
|
COMPATIBILITY SameMajorVersion
|
|
|
|
ARCH_INDEPENDENT
|
|
|
|
)
|
|
|
|
|
|
|
|
install(FILES
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
|
2025-01-13 21:48:49 +01:00
|
|
|
DESTINATION lib/cmake/${PROJECT_NAME}
|
2025-01-14 02:31:39 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
add_subdirectory(data)
|
2025-01-06 23:46:07 +01:00
|
|
|
|
|
|
|
include(cmake/packaging-config.cmake)
|
|
|
|
include(CPack)
|