CompilerFlags.cmake 830 B

123456789101112131415161718192021
  1. # MSVC goes totally bananas if we pass it -Wall
  2. if(NOT MSVC)
  3. enable_if_supported(COMPILER_FLAGS "-Wall")
  4. endif()
  5. enable_if_supported(COMPILER_FLAGS "-Wshorten-64-to-32")
  6. enable_if_supported(COMPILER_FLAGS "-fno-omit-frame-pointer")
  7. enable_if_supported(COMPILER_FLAGS "-mmacosx-version-min=10.9")
  8. enable_if_supported(COMPILER_FLAGS "/Oy-")
  9. # Flags only for external libs
  10. enable_if_supported(COMPILER_FLAGS_THIRD_PARTY "-Wno-shorten-64-to-32")
  11. enable_if_supported(COMPILER_FLAGS_THIRD_PARTY "/wd4244")
  12. enable_if_supported(COMPILER_FLAGS_THIRD_PARTY "/wd4267")
  13. enable_if_links(LINK_FLAGS "-flto")
  14. enable_if_links(LINK_FLAGS "-fuse-ld=gold")
  15. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILER_FLAGS}")
  16. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMPILER_FLAGS}")
  17. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINK_FLAGS}")