diff --git a/CMakeLists.txt b/CMakeLists.txt index d571d42d2a..7bd02d4f5b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,13 @@ option(WITH_TESTS "Build tests") option(PORTABLE "Create a portable build (-rpath=$ORIGIN)" OFF) option(DOWNLOAD_TITLE_SEQUENCES "Download title sequences during installation." ON) +if (FORCE32) + set(TARGET_M "-m32") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TARGET_M}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TARGET_M}") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${TARGET_M}") +endif () + # Define current git branch execute_process( COMMAND git rev-parse --abbrev-ref HEAD diff --git a/src/openrct2-cli/CMakeLists.txt b/src/openrct2-cli/CMakeLists.txt index 383961133a..e060491afc 100644 --- a/src/openrct2-cli/CMakeLists.txt +++ b/src/openrct2-cli/CMakeLists.txt @@ -26,9 +26,5 @@ target_link_libraries(${PROJECT} "libopenrct2") target_include_directories(${PROJECT} PRIVATE "${CMAKE_CURRENT_LIST_DIR}/..") # Compiler flags -if (FORCE32) - set(TARGET_M "-m32") -endif () -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 ${TARGET_M}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14 ${TARGET_M}") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${TARGET_M}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14") diff --git a/src/openrct2-ui/CMakeLists.txt b/src/openrct2-ui/CMakeLists.txt index 1a2a05bf94..ef8cb0fec6 100644 --- a/src/openrct2-ui/CMakeLists.txt +++ b/src/openrct2-ui/CMakeLists.txt @@ -66,18 +66,14 @@ target_include_directories(${PROJECT} PRIVATE "${CMAKE_CURRENT_LIST_DIR}/.." target_include_directories(${PROJECT} SYSTEM PRIVATE ${SDL2_INCLUDE_DIRS}) # Compiler flags -if (FORCE32) - set(TARGET_M "-m32") -endif () if (WIN32) # mingw complains about "%zu" not being a valid format specifier for printf, unless we # tell it that it is set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__USE_MINGW_ANSI_STDIO=1") endif () -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 ${TARGET_M}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14 ${TARGET_M}") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${TARGET_M}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14") # Defines if (DISABLE_OPENGL) diff --git a/src/openrct2/CMakeLists.txt b/src/openrct2/CMakeLists.txt index 65b3549fa4..ee048631b3 100644 --- a/src/openrct2/CMakeLists.txt +++ b/src/openrct2/CMakeLists.txt @@ -241,13 +241,8 @@ else () set(PIE_FLAG "-fpie") endif () -if (FORCE32) - set(TARGET_M "-m32") -endif () - -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 ${COMMON_COMPILE_OPTIONS} ${TARGET_M} -Wimplicit") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14 ${COMMON_COMPILE_OPTIONS} ${TARGET_M}") -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${TARGET_M}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 ${COMMON_COMPILE_OPTIONS} -Wimplicit") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14 ${COMMON_COMPILE_OPTIONS}") # Defines if (USE_MMAP)