From e7eae9aff29e01184ab067a4a8adb4b5a2f4e6a1 Mon Sep 17 00:00:00 2001 From: janisozaur Date: Mon, 18 Apr 2016 15:31:38 +0200 Subject: [PATCH] Fix clang optimized builds (#3336) This apparently applies to non-Apple clang only. When passed any optimization level other than 0, clang took liberty and re-organised arguments passed to `RCT2_CALL*`, even in presence of attributes put in place to prevent that: optnone,noinline. This change allows easier project setup. It was previously possible to produce a clang optimized build by manually recompiling and relinking addresses.c.o. --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8025002baf..79e7de2243 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -194,6 +194,11 @@ INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS} ${LIBCURL_INCLUDE_DIRS} ${JANSSON_INCLU LINK_DIRECTORIES(${SDL2_LIBRARY_DIRS} ${JANSSON_LIBRARY_DIRS} ${LIBCURL_LIBRARY_DIRS} ${PNG_LIBRARY_DIRS} ${ZLIB_LIBRARY_DIRS} ${BREAKPAD_LIBRARY_DIR}) +if (CMAKE_C_COMPILER_ID MATCHES "Clang") + # Disable optimizations for clang, to allow optimized builds + set_source_files_properties(src/addresses.c PROPERTIES COMPILE_FLAGS -O0) +endif() + if (WIN32) # build as library for now, replace with add_executable add_library(${PROJECT} SHARED ${ORCT2_SOURCES} ${SPEEX_SOURCES})