1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-31 10:45:16 +01:00

Refactor compiler flags in CMakeLists.txt

This commit is contained in:
Michał Janiszewski
2016-09-03 09:49:43 +02:00
parent f6e9216b7d
commit cdc447e92a

View File

@@ -82,10 +82,14 @@ option(DISABLE_RCT2 "WIP: Try building without using code and data segments from
option(USE_MMAP "Use mmap to try loading rct2's data segment into memory.")
option(LAUNCHPAD_BUILD "Sets some build system options on launchpad.net")
set(COMMON_COMPILE_OPTIONS "-fPIC -fstrict-aliasing -Werror -Wundef -Wmissing-declarations")
if (LAUNCHPAD_BUILD)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=pointer-to-int-cast -Wno-error=int-to-pointer-cast")
endif()
# Launchpad turns on -Wdate-time for compilers that support it, this shouldn't break our build
set(COMMON_COMPILE_OPTIONS "${COMMON_COMPILE_OPTIONS} -Wno-error=date-time")
else()
if (FORCE64)
set(TARGET_M "-m64")
@@ -214,8 +218,8 @@ if (APPLE)
endif (APPLE)
# set necessary flags to compile code as is
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TARGET_M} -std=gnu99 -fPIC -fstrict-aliasing -Werror -Wno-error=date-time -Wundef -Wmissing-declarations")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TARGET_M} -std=gnu++11 -fPIC -fstrict-aliasing -Werror -Wno-error=date-time -Wundef -Wmissing-declarations")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TARGET_M} -std=gnu99 ${COMMON_COMPILE_OPTIONS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TARGET_M} -std=gnu++11 ${COMMON_COMPILE_OPTIONS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${TARGET_M} -fpie")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS} -fpie")