@@ -84,38 +84,15 @@ target_link_libraries(example4 fftso3)
84
84
# GOOGLE TESTING
85
85
################################################################################
86
86
#
87
- configure_file (CMakeLists.txt.in googletest-download/CMakeLists.txt)
88
- execute_process (COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR} " .
89
- RESULT_VARIABLE result
90
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR} /googletest-download )
91
- if (result)
92
- message (FATAL_ERROR "CMake step for googletest failed: ${result} " )
93
- endif ()
94
- execute_process (COMMAND ${CMAKE_COMMAND} --build .
95
- RESULT_VARIABLE result
96
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR} /googletest-download )
97
- if (result)
98
- message (FATAL_ERROR "Build step for googletest failed: ${result} " )
99
- endif ()
100
-
101
- # Prevent overriding the parent project's compiler/linker
102
- # settings on Windows
87
+ include (FetchContent)
88
+ FetchContent_Declare(
89
+ googletest
90
+ URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
91
+ )
92
+ # For Windows: Prevent overriding the parent project's compiler/linker settings
103
93
set (gtest_force_shared_crt ON CACHE BOOL "" FORCE)
94
+ FetchContent_MakeAvailable(googletest)
104
95
105
- # Add googletest directly to our build. This defines
106
- # the gtest and gtest_main targets.
107
- add_subdirectory (${CMAKE_BINARY_DIR} /googletest-src
108
- ${CMAKE_BINARY_DIR} /googletest-build
109
- EXCLUDE_FROM_ALL )
110
-
111
- # The gtest/gtest_main targets carry header search path
112
- # dependencies automatically when using CMake 2.8.11 or
113
- # later. Otherwise we have to add them here ourselves.
114
- # if (CMAKE_VERSION VERSION_LESS 2.8.11)
115
- include_directories ("${gtest_SOURCE_DIR} /include" )
116
- # endif()
117
-
118
- # Now simply link against gtest or gtest_main as needed. Eg
119
96
add_executable (fftso3_unit_test test /test .cpp)
120
97
target_link_libraries (fftso3_unit_test gtest_main fftso3)
121
98
enable_testing ()
0 commit comments