diff options
author | glx22 <glx@openttd.org> | 2020-06-11 21:57:14 +0200 |
---|---|---|
committer | glx22 <glx22@users.noreply.github.com> | 2020-07-02 21:18:14 +0200 |
commit | 97592c409378c2d353a1cdd6b50f80b7e81b67c2 (patch) | |
tree | 73adb848809067153a3eaae989f8f79c1dcc349d | |
parent | 53de5b5c55f22c3f37db44c4e5ca2c609cbf7b27 (diff) | |
download | openttd-97592c409378c2d353a1cdd6b50f80b7e81b67c2.tar.xz |
Add: [CMake] Allow renaming of openttd binary
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | cmake/InstallAndPackage.cmake | 4 | ||||
-rw-r--r-- | cmake/Options.cmake | 6 |
3 files changed, 11 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 06cd71c3a..364236c86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,10 @@ cmake_minimum_required(VERSION 3.5) -project(OpenTTD) +if (NOT BINARY_NAME) + set(BINARY_NAME openttd) +endif (NOT BINARY_NAME) + +project(${BINARY_NAME}) if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) message(FATAL_ERROR "In-source builds not allowed. Please run \"cmake ..\" from the bin directory") @@ -131,6 +135,7 @@ include(CompileFlags) compile_flags() add_executable(openttd WIN32 ${GENERATED_SOURCE_FILES}) +set_target_properties(openttd PROPERTIES OUTPUT_NAME "${BINARY_NAME}") # All other files are added via target_sources() include(AddCustomXXXTimestamp) diff --git a/cmake/InstallAndPackage.cmake b/cmake/InstallAndPackage.cmake index 6292ecf5a..c8cd6b44a 100644 --- a/cmake/InstallAndPackage.cmake +++ b/cmake/InstallAndPackage.cmake @@ -3,7 +3,7 @@ include(GNUInstallDirs) # If requested, use FHS layout; otherwise fall back to a flat layout. if (OPTION_INSTALL_FHS) set(BINARY_DESTINATION_DIR "${CMAKE_INSTALL_BINDIR}") - set(DATA_DESTINATION_DIR "${CMAKE_INSTALL_DATADIR}/openttd") + set(DATA_DESTINATION_DIR "${CMAKE_INSTALL_DATADIR}/${BINARY_NAME}") set(DOCS_DESTINATION_DIR "${CMAKE_INSTALL_DOCDIR}") set(MAN_DESTINATION_DIR "${CMAKE_INSTALL_MANDIR}") else (OPTION_INSTALL_FHS) @@ -41,7 +41,7 @@ install(FILES # file with little context to what it is. if (OPTION_INSTALL_FHS) set(MAN_SOURCE_FILE ${CMAKE_SOURCE_DIR}/docs/openttd.6) - set(MAN_BINARY_FILE ${CMAKE_BINARY_DIR}/docs/openttd.6) + set(MAN_BINARY_FILE ${CMAKE_BINARY_DIR}/docs/${BINARY_NAME}.6) install(CODE " execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${MAN_SOURCE_FILE} ${MAN_BINARY_FILE}) diff --git a/cmake/Options.cmake b/cmake/Options.cmake index 4210c5b49..4f2404b2d 100644 --- a/cmake/Options.cmake +++ b/cmake/Options.cmake @@ -14,9 +14,9 @@ function(set_directory_options) set(DEFAULT_SHARED_DIR "(not set)") set(DEFAULT_GLOBAL_DIR "(not set)") elseif (UNIX) - set(DEFAULT_PERSONAL_DIR ".openttd") + set(DEFAULT_PERSONAL_DIR ".${BINARY_NAME}") set(DEFAULT_SHARED_DIR "(not set)") - set(DEFAULT_GLOBAL_DIR "${CMAKE_INSTALL_FULL_DATADIR}/openttd") + set(DEFAULT_GLOBAL_DIR "${CMAKE_INSTALL_FULL_DATADIR}/${BINARY_NAME}") else () message(FATAL_ERROR "Unknown OS found; please consider creating a Pull Request to add support for this OS.") endif () @@ -51,7 +51,7 @@ function(set_options) option(OPTION_FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." OFF) option(OPTION_DEDICATED "Build dedicated server only (no GUI)" OFF) - option(OPTION_INSTALL_FHS "Install with Filesstem Hierarchy Standard folders" ${DEFAULT_OPTION_INSTALL_FHS}) + option(OPTION_INSTALL_FHS "Install with Filesystem Hierarchy Standard folders" ${DEFAULT_OPTION_INSTALL_FHS}) option(OPTION_USE_ASSERTS "Use assertions; leave enabled for nightlies, betas, and RCs" ON) option(OPTION_USE_THREADS "Use threads" ON) option(OPTION_USE_NSIS "Use NSIS to create windows installer; enable only for stable releases" OFF) |