| 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 |
|
| 34 |
# Suppress all warnings from external projects. |
| 35 |
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS -w) |
| 36 |
|
| 37 |
if(BUILD_TESTING) |
| 38 |
if(TARGET gmock) |
| 39 |
message(STATUS "Google Mock already configured - use it") |
| 40 |
elseif(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/googletest) |
| 41 |
# We need to make sure Google Test does not mess up with the |
| 42 |
# global CRT settings on Windows. |
| 43 |
if(WIN32) |
| 44 |
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) |
| 45 |
endif(WIN32) |
| 46 |
# EXCLUDE_FROM_ALL keeps the install target from installing GTEST files. |
| 47 |
add_subdirectory(googletest EXCLUDE_FROM_ALL) |
| 48 |
set(GTEST_TARGETS |
| 49 |
gtest |
| 50 |
gtest_main |
| 51 |
gmock |
| 52 |
gmock_main) |
| 53 |
foreach(target ${GTEST_TARGETS}) |
| 54 |
set_property(TARGET ${target} PROPERTY FOLDER gtest) |
| 55 |
endforeach() |
| 56 |
mark_as_advanced(gmock_build_tests |
| 57 |
BUILD_GMOCK |
| 58 |
BUILD_GTEST |
| 59 |
BUILD_SHARED_LIBS |
| 60 |
gtest_build_samples |
| 61 |
gtest_build_tests |
| 62 |
gtest_disable_pthreads |
| 63 |
gtest_force_shared_crt |
| 64 |
gtest_hide_internal_symbols) |
| 65 |
else() |
| 66 |
message(STATUS |
| 67 |
"Google Mock was not found - tests based on that will not build") |
| 68 |
endif() |
| 69 |
endif() |
| 70 |
|
| 71 |
if(ENABLE_OPT AND NOT TARGET SPIRV-Tools-opt) |
| 72 |
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/spirv-tools) |
| 73 |
set(SPIRV_SKIP_TESTS ON CACHE BOOL "Skip building SPIRV-Tools tests") |
| 74 |
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/spirv-tools spirv-tools) |
| 75 |
endif() |
| 76 |
endif() |
| 77 |
|