CMakeLists.txt 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # Copyright (C) 2020 The Khronos Group Inc.
  2. #
  3. # All rights reserved.
  4. #
  5. # Redistribution and use in source and binary forms, with or without
  6. # modification, are permitted provided that the following conditions
  7. # are met:
  8. #
  9. # Redistributions of source code must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. #
  12. # Redistributions in binary form must reproduce the above
  13. # copyright notice, this list of conditions and the following
  14. # disclaimer in the documentation and/or other materials provided
  15. # with the distribution.
  16. #
  17. # Neither the name of The Khronos Group Inc. nor the names of its
  18. # contributors may be used to endorse or promote products derived
  19. # from this software without specific prior written permission.
  20. #
  21. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  24. # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  25. # COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  26. # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  27. # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  28. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29. # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30. # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  31. # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  32. # POSSIBILITY OF SUCH DAMAGE.
  33. # Suppress all warnings from external projects.
  34. set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS -w)
  35. if(GLSLANG_TESTS)
  36. if(TARGET gmock)
  37. message(STATUS "Google Mock already configured - use it")
  38. elseif(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/googletest)
  39. # We need to make sure Google Test does not mess up with the
  40. # global CRT settings on Windows.
  41. if(WIN32)
  42. set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
  43. endif(WIN32)
  44. # EXCLUDE_FROM_ALL keeps the install target from installing GTEST files.
  45. add_subdirectory(googletest EXCLUDE_FROM_ALL)
  46. set(GTEST_TARGETS
  47. gtest
  48. gtest_main
  49. gmock
  50. gmock_main)
  51. foreach(target ${GTEST_TARGETS})
  52. set_property(TARGET ${target} PROPERTY FOLDER gtest)
  53. endforeach()
  54. mark_as_advanced(gmock_build_tests
  55. BUILD_GMOCK
  56. BUILD_GTEST
  57. BUILD_SHARED_LIBS
  58. gtest_build_samples
  59. gtest_build_tests
  60. gtest_disable_pthreads
  61. gtest_force_shared_crt
  62. gtest_hide_internal_symbols)
  63. else()
  64. message(STATUS
  65. "Google Mock was not found - tests based on that will not build")
  66. endif()
  67. endif()
  68. if(ENABLE_OPT AND NOT TARGET SPIRV-Tools-opt)
  69. if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/spirv-tools)
  70. set(SPIRV_SKIP_TESTS ON CACHE BOOL "Skip building SPIRV-Tools tests")
  71. add_subdirectory(spirv-tools)
  72. endif()
  73. endif()