StandardProjectSettings.cmake 1002 B

12345678910111213141516171819202122232425262728293031323334
  1. # Set a default build type if none was specified
  2. if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
  3. message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
  4. set(CMAKE_BUILD_TYPE
  5. RelWithDebInfo
  6. CACHE STRING "Choose the type of build." FORCE)
  7. # Set the possible values of build type for cmake-gui, ccmake
  8. set_property(
  9. CACHE CMAKE_BUILD_TYPE
  10. PROPERTY STRINGS
  11. "Debug"
  12. "Release"
  13. "MinSizeRel"
  14. "RelWithDebInfo")
  15. endif()
  16. # Generate compile_commands.json to make it easier to work with clang based tools
  17. set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
  18. option(ENABLE_IPO "Enable Interprocedural Optimization, aka Link Time Optimization (LTO)" OFF)
  19. if(ENABLE_IPO)
  20. include(CheckIPOSupported)
  21. check_ipo_supported(
  22. RESULT
  23. result
  24. OUTPUT
  25. output)
  26. if(result)
  27. set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
  28. else()
  29. message(SEND_ERROR "IPO is not supported: ${output}")
  30. endif()
  31. endif()