@@ -3,36 +3,39 @@ if (NOT EXISTS ${XPTI_SOURCE_DIR})
3
3
endif ()
4
4
include_directories (${XPTI_SOURCE_DIR} /include )
5
5
6
- # Download and unpack googletest at configure time
7
- configure_file (../CMakeLists.txt.in googletest-download/CMakeLists.txt)
8
- execute_process (COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR} " .
9
- RESULT_VARIABLE result
10
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /googletest-download )
11
- if (result)
12
- message (FATAL_ERROR "CMake step for googletest failed: ${result} " )
13
- endif ()
14
- execute_process (COMMAND ${CMAKE_COMMAND} --build .
15
- RESULT_VARIABLE result
16
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /googletest-download )
17
- if (result)
18
- message (FATAL_ERROR "Build step for googletest failed: ${result} " )
19
- endif ()
6
+ # Only download Google Test outside of LLVM tree.
7
+ if (NOT DEFINED LLVM_EXTERNAL_XPTIFW_SOURCE_DIR)
8
+ # Download and unpack googletest at configure time
9
+ configure_file (../CMakeLists.txt.in googletest-download/CMakeLists.txt)
10
+ execute_process (COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR} " .
11
+ RESULT_VARIABLE result
12
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /googletest-download )
13
+ if (result)
14
+ message (FATAL_ERROR "CMake step for googletest failed: ${result} " )
15
+ endif ()
16
+ execute_process (COMMAND ${CMAKE_COMMAND} --build .
17
+ RESULT_VARIABLE result
18
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /googletest-download )
19
+ if (result)
20
+ message (FATAL_ERROR "Build step for googletest failed: ${result} " )
21
+ endif ()
20
22
21
- # Prevent overriding the parent project's compiler/linker
22
- # settings on Windows
23
- set (gtest_force_shared_crt ON CACHE BOOL "" FORCE)
23
+ # Prevent overriding the parent project's compiler/linker
24
+ # settings on Windows
25
+ set (gtest_force_shared_crt ON CACHE BOOL "" FORCE)
24
26
25
- # Add googletest directly to our build. This defines
26
- # the gtest and gtest_main targets.
27
- add_subdirectory (${CMAKE_CURRENT_BINARY_DIR} /googletest-src
28
- ${CMAKE_CURRENT_BINARY_DIR} /googletest-build
29
- EXCLUDE_FROM_ALL )
27
+ # Add googletest directly to our build. This defines
28
+ # the gtest and gtest_main targets.
29
+ add_subdirectory (${CMAKE_CURRENT_BINARY_DIR} /googletest-src
30
+ ${CMAKE_CURRENT_BINARY_DIR} /googletest-build
31
+ EXCLUDE_FROM_ALL )
30
32
31
- # The gtest/gtest_main targets carry header search path
32
- # dependencies automatically when using CMake 2.8.11 or
33
- # later. Otherwise we have to add them here ourselves.
34
- if (CMAKE_VERSION VERSION_LESS 2.8.11)
35
- include_directories ("${gtest_SOURCE_DIR} /include" )
33
+ # The gtest/gtest_main targets carry header search path
34
+ # dependencies automatically when using CMake 2.8.11 or
35
+ # later. Otherwise we have to add them here ourselves.
36
+ if (CMAKE_VERSION VERSION_LESS 2.8.11)
37
+ include_directories ("${gtest_SOURCE_DIR} /include" )
38
+ endif ()
36
39
endif ()
37
40
38
41
# Now simply link against gtest or gtest_main as needed. Eg
0 commit comments