Commits

Shlomi Fish committed e7dcbd8

Add support for gcc-4.5.0's -flto flag. It makes the benchmark faster.

git-svn-id: file:///home/shlomif/Backup/svn-dumps/google-code/svnsync-repos/fc-solve/branches/likely-addition@2898 e7e8a897-7ba4-4ee7-b36f-f4c66519b19a

  • Participants
  • Parent commits 8f72729
  • Branches likely-addition, likely-addition@3680

Comments (0)

Files changed (1)

File fc-solve/source/CMakeLists.txt

     ENDFOREACH (TREE_TYPE ${LIBAVL2_TREE_TYPES})
 ENDIF (LIBAVL2_TREE_TYPES)
 
-SET (MY_LINK_FLAGS "")
+SET (MY_LINK_FLAGS )
 SET (MY_TO_PROFILE "")
 IF (CMAKE_BUILD_TYPE STREQUAL profile)
     SET (MY_TO_PROFILE "1")
     SET (CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_DEBUG} -pg")
-    SET (MY_LINK_FLAGS "-pg -static-libgcc")
+    LIST (APPEND MY_LINK_FLAGS "-pg" "-static-libgcc")
     SET (BUILD_STATIC_LIBRARY "1")
     SET (MY_TARGET_LINK_LIBS "freecell-solver-static" "m_p" "c_p")
 ELSE (CMAKE_BUILD_TYPE STREQUAL profile)
     LIST(APPEND COMPILER_FLAGS_TO_CHECK "-DFCS_COMPILE_DEBUG_FUNCTIONS=1")
 ENDIF (CMAKE_BUILD_TYPE STREQUAL debug)
 
+IF (CMAKE_BUILD_TYPE STREQUAL release)
+    LIST(APPEND COMPILER_FLAGS_TO_CHECK "-flto")
+ENDIF (CMAKE_BUILD_TYPE STREQUAL release)
+
 SET (IDX 1)
 FOREACH (CFLAG_TO_CHECK ${COMPILER_FLAGS_TO_CHECK})
     SET (FLAG_EXISTS_VAR "FLAG_EXISTS_${IDX}")
     CHECK_C_COMPILER_FLAG("${CFLAG_TO_CHECK}" ${FLAG_EXISTS_VAR})
     IF (${FLAG_EXISTS_VAR})
         ADD_DEFINITIONS(${CFLAG_TO_CHECK})
+        LIST(APPEND MY_LINK_FLAGS "${CFLAG_TO_CHECK}")
     ENDIF (${FLAG_EXISTS_VAR})
 ENDFOREACH(CFLAG_TO_CHECK)
 
     )
 ENDIF (UNIX)
 
+STRING (REPLACE ";" " "  MY_LINK_FLAGS_STRING "${MY_LINK_FLAGS}")
+
 IF (MY_LINK_FLAGS)
     SET_TARGET_PROPERTIES(
         ${FREECELL_SOLVER_LIBS} 
         ${FREECELL_SOLVER_EXECUTABLES}
-        PROPERTIES LINK_FLAGS "${MY_LINK_FLAGS}"
+        PROPERTIES LINK_FLAGS "${MY_LINK_FLAGS_STRING}"
     )
 ENDIF (MY_LINK_FLAGS)