Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
flto has not the right effect with clang
authorAugustin Degomme <degomme@idpann.imag.fr>
Thu, 7 Nov 2013 23:02:22 +0000 (00:02 +0100)
committerAugustin Degomme <degomme@idpann.imag.fr>
Thu, 7 Nov 2013 23:02:22 +0000 (00:02 +0100)
buildtools/Cmake/Flags.cmake

index 4c1178d..058ea2d 100644 (file)
@@ -26,15 +26,17 @@ endif()
 
 if(enable_compile_optimizations)
   set(optCFLAGS "-O3 -finline-functions -funroll-loops -fno-strict-aliasing ")
 
 if(enable_compile_optimizations)
   set(optCFLAGS "-O3 -finline-functions -funroll-loops -fno-strict-aliasing ")
-  if(WIN32)
-    if (COMPILER_C_VERSION_MAJOR_MINOR STRGREATER "4.7")
-    # On windows, we need 4.8 or higher to enable lto because of http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50293
-      set(optCFLAGS "${optCFLAGS} -flto ")
-    endif()
-  else()    
-    # On non-windows, 4.6 is enough for that
-    if(COMPILER_C_VERSION_MAJOR_MINOR STRGREATER "4.5")
-      set(optCFLAGS "${optCFLAGS} -flto ")
+  if(CMAKE_COMPILER_IS_GNUCC)
+    if(WIN32)
+      if (COMPILER_C_VERSION_MAJOR_MINOR STRGREATER "4.7")
+      # On windows, we need 4.8 or higher to enable lto because of http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50293
+        set(optCFLAGS "${optCFLAGS} -flto ")
+      endif()
+    else()    
+      # On non-windows, 4.6 is enough for that
+      if(COMPILER_C_VERSION_MAJOR_MINOR STRGREATER "4.5")
+        set(optCFLAGS "${optCFLAGS} -flto ")
+      endif()
     endif()
   endif()
 else()
     endif()
   endif()
 else()