blob: cbabd2e3b4ac80cb9d0a6b55080e3e6821d4ccaa [file] [log] [blame]
Ben Clayton1d212702020-07-01 15:43:36 +01001# 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#
Ben Claytoncb261e32020-07-03 12:21:01 +010017# Neither the name of The Khronos Group Inc. nor the names of its
Ben Clayton1d212702020-07-01 15:43:36 +010018# 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
Lei Zhang414eb602016-03-04 16:22:34 -050034# Suppress all warnings from external projects.
35set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS -w)
36
David Seifert22afc382017-04-29 10:57:36 +020037if(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)
Karl Schultz1d1fd882019-04-02 14:58:25 -060046 # EXCLUDE_FROM_ALL keeps the install target from installing GTEST files.
47 add_subdirectory(googletest EXCLUDE_FROM_ALL)
David Seifert22afc382017-04-29 10:57:36 +020048 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()
Lei Zhang414eb602016-03-04 16:22:34 -050069endif()
GregFfd34f0e2017-09-21 16:50:39 -060070
71if(ENABLE_OPT AND NOT TARGET SPIRV-Tools-opt)
72 if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/spirv-tools)
GregFb56366a2017-09-27 11:34:48 -060073 set(SPIRV_SKIP_TESTS ON CACHE BOOL "Skip building SPIRV-Tools tests")
GregFfd34f0e2017-09-21 16:50:39 -060074 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/spirv-tools spirv-tools)
75 endif()
76endif()
77