CompilerFlags.cmake 1.1 KB

1234567891011121314151617181920212223242526
  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. enable_if_supported(COMPILER_FLAGS "-fvisibility-inlines-hidden")
  10. # Flags only for external libs
  11. enable_if_supported(COMPILER_FLAGS_THIRD_PARTY "-Wno-shorten-64-to-32")
  12. enable_if_supported(COMPILER_FLAGS_THIRD_PARTY "/wd4244")
  13. enable_if_supported(COMPILER_FLAGS_THIRD_PARTY "/wd4267")
  14. enable_if_links(LINK_FLAGS_RELEASE "-flto")
  15. enable_if_links(LINK_FLAGS "-fuse-ld=gold")
  16. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILER_FLAGS}")
  17. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMPILER_FLAGS}")
  18. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINK_FLAGS}")
  19. # release link flags
  20. set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${LINK_FLAGS_RELEASE}")
  21. set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} ${LINK_FLAGS_RELEASE}")