Skip to content

Commit 442a0d5

Browse files
authored
Fix googletest CMake build (#740)
1 parent c057ca3 commit 442a0d5

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

tests/Makefile

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ GMOCK_DIR = $(CURDIR)/googletest/googlemock
2222

2323
CMAKE=cmake
2424

25-
TESTFLAGS = -I$(GTEST_DIR)/include -L$(GTEST_DIR)/make/lib -lgtest
25+
TESTFLAGS = -I$(GTEST_DIR)/include -L$(GTEST_DIR)/build/lib -lgtest
2626

2727
.PHONY: cxx-tests
2828
cxx-tests: $(CXX_TARGETS)
@@ -52,24 +52,25 @@ run-custatevec-tests: custatevec-tests
5252
run-hip-tests: hip-tests
5353
for exe in $(HIP_TARGETS); do if ! ./$$exe; then exit 1; fi; done
5454

55-
$(GTEST_DIR)/make:
55+
$(GTEST_DIR)/build:
5656
-git submodule update --init --recursive googletest
57-
mkdir -p $(GTEST_DIR)/make
58-
cd $(GTEST_DIR)/make && $(CMAKE) .. && $(MAKE)
57+
mkdir -p $(GTEST_DIR)/build
58+
cd $(GTEST_DIR) && $(CMAKE) -B build -S ..
59+
cd $(GTEST_DIR)/build && make
5960

60-
%.x: %.cc $(GTEST_DIR)/make
61+
%.x: %.cc $(GTEST_DIR)/build
6162
$(CXX) -o ./$@ $< $(TESTFLAGS) $(CXXFLAGS) $(ARCHFLAGS)
6263

63-
%cuda_test.x: %cuda_test.cu $(GTEST_DIR)/make
64+
%cuda_test.x: %cuda_test.cu $(GTEST_DIR)/build
6465
$(NVCC) -o ./$@ $< $(TESTFLAGS) $(NVCCFLAGS)
6566

66-
%custatevec_test.x: %custatevec_test.cu $(GTEST_DIR)/make
67+
%custatevec_test.x: %custatevec_test.cu $(GTEST_DIR)/build
6768
$(NVCC) -o ./$@ $< $(TESTFLAGS) $(NVCCFLAGS) $(CUSTATEVECFLAGS)
6869

69-
%hip_test.x: %cuda_test.cu $(GTEST_DIR)/make
70+
%hip_test.x: %cuda_test.cu $(GTEST_DIR)/build
7071
$(HIPCC) -o ./$@ $< $(TESTFLAGS) $(HIPCCFLAGS)
7172

7273
.PHONY: clean
7374
clean:
7475
-rm -f ./*.x ./*.a ./*.so ./*.mod
75-
rm -rf $(GTEST_DIR)/make
76+
rm -rf $(GTEST_DIR)/build

0 commit comments

Comments
 (0)