Skip to content

Commit ce8ef3a

Browse files
Taeyoung LeeTaeyoung Lee
Taeyoung Lee
authored and
Taeyoung Lee
committed
googletest resolved
1 parent 440b104 commit ce8ef3a

File tree

2 files changed

+8
-30
lines changed

2 files changed

+8
-30
lines changed

CMakeLists.txt

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -84,38 +84,15 @@ target_link_libraries(example4 fftso3)
8484
# GOOGLE TESTING
8585
################################################################################
8686
#
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
10393
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
94+
FetchContent_MakeAvailable(googletest)
10495

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
11996
add_executable(fftso3_unit_test test/test.cpp)
12097
target_link_libraries(fftso3_unit_test gtest_main fftso3)
12198
enable_testing()

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Please follow the instruction at each link to install the libraries, except the
6969
```
7070
brew install cmake
7171
brew install llvm
72+
brew install libomp
7273
```
7374

7475
**Tips for Linux:** For Debian linux, such as Ubuntu, the above packages can be installed by

0 commit comments

Comments
 (0)