Changeset - r24312:91e366a9aaa0
[Not reviewed]
master
0 3 0
glx22 - 4 years ago 2020-06-11 19:57:14
glx@openttd.org
Add: [CMake] Allow renaming of openttd binary
3 files changed with 11 insertions and 6 deletions:
0 comments (0 inline, 0 general)
CMakeLists.txt
Show inline comments
 
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")
 
endif (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
 

	
 
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
 
@@ -128,12 +132,13 @@ include_directories(${CMAKE_SOURCE_DIR}/
 
include_directories(${CMAKE_SOURCE_DIR}/src/3rdparty/squirrel/include)
 

	
 
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)
 
add_subdirectory(${CMAKE_SOURCE_DIR}/src)
 
add_subdirectory(${CMAKE_SOURCE_DIR}/media/baseset)
 

	
cmake/InstallAndPackage.cmake
Show inline comments
 
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)
 
    set(BINARY_DESTINATION_DIR ".")
 
    set(DATA_DESTINATION_DIR ".")
 
    set(DOCS_DESTINATION_DIR ".")
 
@@ -38,13 +38,13 @@ install(FILES
 
        COMPONENT docs)
 

	
 
# A Linux manual only makes sense when using FHS. Otherwise it is a very odd
 
# 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})
 
                execute_process(COMMAND gzip -9 -f ${MAN_BINARY_FILE})
 
            "
 
            COMPONENT manual)
cmake/Options.cmake
Show inline comments
 
@@ -11,15 +11,15 @@ function(set_directory_options)
 
        set(DEFAULT_GLOBAL_DIR "(not set)")
 
    elseif (WIN32)
 
        set(DEFAULT_PERSONAL_DIR "OpenTTD")
 
        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 ()
 

	
 
    if (NOT PERSONAL_DIR)
 
        set(PERSONAL_DIR "${DEFAULT_PERSONAL_DIR}" CACHE STRING "Personal directory")
 
@@ -48,13 +48,13 @@ function(set_options)
 
        set(DEFAULT_OPTION_INSTALL_FHS OFF)
 
    endif (UNIX AND NOT APPLE)
 

	
 
    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)
 
endfunction()
 

	
 
# Show the values of the generic options.
0 comments (0 inline, 0 general)