CMakeLists.txt
changeset 15474 6e09555b25b4
parent 15469 88770c206c31
child 15475 47cf2cf736e7
equal deleted inserted replaced
15473:6e4ca1c46370 15474:6e09555b25b4
    52 
    52 
    53 option(NOVERSIONINFOUPDATE "Disable update of version_info.txt. To be used if source is in a git/repo that is NOT the hedgewars repo" OFF)
    53 option(NOVERSIONINFOUPDATE "Disable update of version_info.txt. To be used if source is in a git/repo that is NOT the hedgewars repo" OFF)
    54 
    54 
    55 
    55 
    56 if(BUILD_ENGINE_C AND NOT NOVIDEOREC)
    56 if(BUILD_ENGINE_C AND NOT NOVIDEOREC)
    57     if((CMAKE_BUILD_TYPE MATCHES "RELEASE") OR (CMAKE_BUILD_TYPE MATCHES "RELWITHDEBUGINFO"))
    57     if((CMAKE_BUILD_TYPE MATCHES "Release") OR (CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo"))
    58         message("NOTE: Video recorder support disabled. It's incompatible with BUILD_ENGINE_C")
    58         message("NOTE: Video recorder support disabled. It's incompatible with BUILD_ENGINE_C")
    59         set(BUILD_ENGINE_C ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
    59         set(BUILD_ENGINE_C ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
    60     else()
    60     else()
    61         message("WARNING: Video recorder support is currently incompatible with BUILD_ENGINE_C, the video recorder won't work (but demos are fine)! See <https://issues.hedgewars.org/show_bug.cgi?id=722>.")
    61         message("WARNING: Video recorder support is currently incompatible with BUILD_ENGINE_C, the video recorder won't work (but demos are fine)! See <https://issues.hedgewars.org/show_bug.cgi?id=722>.")
    62     endif()
    62     endif()
    91 #versioning
    91 #versioning
    92 set(CPACK_PACKAGE_VERSION_MAJOR 1)
    92 set(CPACK_PACKAGE_VERSION_MAJOR 1)
    93 set(CPACK_PACKAGE_VERSION_MINOR 0)
    93 set(CPACK_PACKAGE_VERSION_MINOR 0)
    94 set(CPACK_PACKAGE_VERSION_PATCH 0)
    94 set(CPACK_PACKAGE_VERSION_PATCH 0)
    95 set(HEDGEWARS_PROTO_VER 59)
    95 set(HEDGEWARS_PROTO_VER 59)
    96 if((CMAKE_BUILD_TYPE MATCHES "RELEASE") OR (CMAKE_BUILD_TYPE MATCHES "RELWITHDEBUGINFO"))
    96 if((CMAKE_BUILD_TYPE MATCHES "Release") OR (CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo"))
    97     set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
    97     set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
    98 else()
    98 else()
    99     set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-dev")
    99     set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-dev")
   100 endif()
   100 endif()
   101 include(${CMAKE_MODULE_PATH}/revinfo.cmake)
   101 include(${CMAKE_MODULE_PATH}/revinfo.cmake)
   111 
   111 
   112 
   112 
   113 #when build type is not specified, assume Debug/Release according to build version information
   113 #when build type is not specified, assume Debug/Release according to build version information
   114 if(CMAKE_BUILD_TYPE)
   114 if(CMAKE_BUILD_TYPE)
   115     string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
   115     string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
   116     if(NOT((CMAKE_BUILD_TYPE MATCHES "RELEASE") OR
   116     if(NOT((CMAKE_BUILD_TYPE MATCHES "Release") OR
   117            (CMAKE_BUILD_TYPE MATCHES "DEBUG") OR
   117            (CMAKE_BUILD_TYPE MATCHES "Debug") OR
   118            (CMAKE_BUILD_TYPE MATCHES "RELWITHDEBINFO")))
   118            (CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo")))
   119         set(CMAKE_BUILD_TYPE ${default_build_type} CACHE STRING "Build type (Debug/Release/RelWithDebInfo)" FORCE)
   119         set(CMAKE_BUILD_TYPE ${default_build_type} CACHE STRING "Build type (Debug/Release/RelWithDebInfo)" FORCE)
   120         message(STATUS "Unknown build type ${CMAKE_BUILD_TYPE}, using default (${default_build_type})")
   120         message(STATUS "Unknown build type ${CMAKE_BUILD_TYPE}, using default (${default_build_type})")
   121     endif()
   121     endif()
   122 else(CMAKE_BUILD_TYPE)
   122 else(CMAKE_BUILD_TYPE)
   123     set(CMAKE_BUILD_TYPE ${default_build_type} CACHE STRING "Build type (Debug/Release/RelWithDebInfo)" FORCE)
   123     set(CMAKE_BUILD_TYPE ${default_build_type} CACHE STRING "Build type (Debug/Release/RelWithDebInfo)" FORCE)
   166 endif()
   166 endif()
   167 
   167 
   168 
   168 
   169 #get BUILD_TYPE and enable/disable optimisation
   169 #get BUILD_TYPE and enable/disable optimisation
   170 message(STATUS "Using ${CMAKE_BUILD_TYPE} configuration")
   170 message(STATUS "Using ${CMAKE_BUILD_TYPE} configuration")
   171 if(CMAKE_BUILD_TYPE MATCHES "DEBUG")
   171 if(CMAKE_BUILD_TYPE MATCHES "Debug")
   172     list(APPEND haskell_flags "-Wall"       # all warnings
   172     list(APPEND haskell_flags "-Wall"       # all warnings
   173                               "-debug"      # debug mode
   173                               "-debug"      # debug mode
   174                               "-fno-warn-unused-do-bind"
   174                               "-fno-warn-unused-do-bind"
   175                               "-O0"
   175                               "-O0"
   176                               )
   176                               )