OSX/cmake: simplificate compile conditions and silence lot of CLANG warnings
authorJens Verwiebe <info@jensverwiebe.de>
Mon, 1 Oct 2012 14:03:02 +0000 (14:03 +0000)
committerJens Verwiebe <info@jensverwiebe.de>
Mon, 1 Oct 2012 14:03:02 +0000 (14:03 +0000)
CMakeLists.txt

index 51d900ae35dcbd1601589b7da0fd959c0b9fd316..79070a77bb2a58af81560ef0b5acb72b83772630 100644 (file)
@@ -1648,12 +1648,13 @@ elseif(APPLE)
 
        set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
        set(CMAKE_CXX_FLAGS_DEBUG "-fno-strict-aliasing -g")
-       if(CMAKE_OSX_ARCHITECTURES MATCHES "i386")
-               set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -fvariable-expansion-in-unroller")
-               set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -fvariable-expansion-in-unroller")
-       elseif(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
-               set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -msse3 -mssse3 -fvariable-expansion-in-unroller")
-               set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -msse3 -mssse3 -fvariable-expansion-in-unroller")
+       if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR CMAKE_OSX_ARCHITECTURES MATCHES "i386")
+               set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
+               set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic  -msse -msse2 -msse3 -mssse3")
+               if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+                       set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ftree-vectorize  -fvariable-expansion-in-unroller")
+                       set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ftree-vectorize  -fvariable-expansion-in-unroller")
+               endif()
        else()
                set(CMAKE_C_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
                set(CMAKE_CXX_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")