*/}}

lagui-config.cmake 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. # LaGUI CMake config file.
  2. get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
  3. include(${SELF_DIR}/lagui-targets.cmake)
  4. get_filename_component(LAGUI_INCLUDE_DIRS "${SELF_DIR}/../../include/lagui" ABSOLUTE)
  5. if (POLICY CMP0072)
  6. set(OpenGL_GL_PREFERENCE GLVND)
  7. endif()
  8. find_package(OpenGL REQUIRED)
  9. find_package(X11 REQUIRED)
  10. find_package(Freetype REQUIRED)
  11. find_package(GLEW REQUIRED)
  12. find_package(PNG REQUIRED)
  13. set(LAGUI_SHARED_LIBS
  14. ${X11_LIBRARIES}
  15. ${X11_X11_LIB}
  16. ${GLEW_LIBRARIES}
  17. ${OPENGL_LIBRARY}
  18. ${FREETYPE_LIBRARIES}
  19. ${X11_Xfixes_LIB}
  20. ${PNG_LIBRARY}
  21. m X11 Xi Xcursor
  22. lagui
  23. CACHE INTERNAL "LaGUI shared libs"
  24. )
  25. set(LAGUI_INCLUDE_DIRS_ALL
  26. ${CMAKE_SOURCE_DIR}
  27. ${X11_INCLUDE_DIR}
  28. ${GLEW_INCLUDE_PATH}
  29. ${FREETYPE_INCLUDE_DIRS}
  30. ${LAGUI_INCLUDE_DIRS}
  31. CACHE INTERNAL "Include dirs of LaGUI and dependencies"
  32. )
  33. # Build Types
  34. set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}
  35. CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel tnsan asan lsan msan ubsan"
  36. FORCE)
  37. # ThreadSanitizer
  38. set(CMAKE_C_FLAGS_TSAN
  39. "-fsanitize=thread -g -O1"
  40. CACHE STRING "Flags used by the C compiler during ThreadSanitizer builds."
  41. FORCE)
  42. set(CMAKE_CXX_FLAGS_TSAN
  43. "-fsanitize=thread -g -O1"
  44. CACHE STRING "Flags used by the C++ compiler during ThreadSanitizer builds."
  45. FORCE)
  46. # AddressSanitize
  47. set(CMAKE_C_FLAGS_ASAN
  48. "-fsanitize=address -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g"
  49. CACHE STRING "Flags used by the C compiler during AddressSanitizer builds."
  50. FORCE)
  51. set(CMAKE_CXX_FLAGS_ASAN
  52. "-fsanitize=address -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g"
  53. CACHE STRING "Flags used by the C++ compiler during AddressSanitizer builds."
  54. FORCE)
  55. # LeakSanitizer
  56. set(CMAKE_C_FLAGS_LSAN
  57. "-fsanitize=leak -fno-omit-frame-pointer -g"
  58. CACHE STRING "Flags used by the C compiler during LeakSanitizer builds."
  59. FORCE)
  60. set(CMAKE_CXX_FLAGS_LSAN
  61. "-fsanitize=leak -fno-omit-frame-pointer -g"
  62. CACHE STRING "Flags used by the C++ compiler during LeakSanitizer builds."
  63. FORCE)
  64. # MemorySanitizer
  65. set(CMAKE_C_FLAGS_MSAN
  66. "-fsanitize=memory -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -g"
  67. CACHE STRING "Flags used by the C compiler during MemorySanitizer builds."
  68. FORCE)
  69. set(CMAKE_CXX_FLAGS_MSAN
  70. "-fsanitize=memory -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -g"
  71. CACHE STRING "Flags used by the C++ compiler during MemorySanitizer builds."
  72. FORCE)
  73. # UndefinedBehaviour
  74. set(CMAKE_C_FLAGS_UBSAN
  75. "-fsanitize=undefined"
  76. CACHE STRING "Flags used by the C compiler during UndefinedBehaviourSanitizer builds."
  77. FORCE)
  78. set(CMAKE_CXX_FLAGS_UBSAN
  79. "-fsanitize=undefined"
  80. CACHE STRING "Flags used by the C++ compiler during UndefinedBehaviourSanitizer builds."
  81. FORCE)