Skip to content

Commit a4c6f5a

Browse files
authored
Merge pull request #761 from deepmodeling/cmake
Build: Find Googletest by custom dir locally.
2 parents ebf1afe + 469903b commit a4c6f5a

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ IF (BUILD_TESTING)
225225
enable_testing()
226226
find_package(Threads)
227227
set(CMAKE_CXX_STANDARD_REQUIRED ON)
228-
find_package(GTest)
229-
if(NOT ${GTEST_FOUND})
228+
find_package(GTest HINTS /usr/local/lib/ ${GTEST_DIR})
229+
if(NOT DEFINED ${GTest_FOUND})
230230
include(FetchContent)
231231
FetchContent_Declare(
232232
googletest

doc/developers.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
- [Code Formatting style](#code-formatting-style)
1212
[back to main page](../README.md)
1313

14-
## Raising issues on GitHub
14+
## Creating issues on GitHub
1515

16-
Raising issues on GitHub is a convernient way to notify the develper team about bugs and feature requests of the ABACUS code. We provide a few templates for issues.
16+
Creating issues on GitHub is a convernient way to notify the develper team about bugs and feature requests of the ABACUS code. We provide a few templates for issues.
1717

1818
[back to top](#for-developers)
1919

@@ -23,7 +23,7 @@ The ABACUS code is refactored to several self-contained modules. A description o
2323

2424
### Add a unit test
2525

26-
If there are currently no unit tests provided for the module, do as follows. `module_base` provides a simple demonstration.
26+
We use GoogleTest as our test framework. Write your test under the corresponding module folder at `abacus-develop/tests`, then append the test to `tests/CMakeLists.txt`. If there are currently no unit tests provided for the module, do as follows. `module_base` provides a simple demonstration.
2727

2828
- Add a folder named `test` under the module.
2929
- Append the content below to `CMakeLists.txt` of the module:
@@ -106,9 +106,6 @@ After your pull request is merged, you can safely delete your branch and pull th
106106
git pull --ff upstream develop
107107
```
108108

109-
### Providing unit tests
110-
111-
We use GoogleTest as our test framework. Write your test under the corresponding module folder at `abacus-develop/tests`, then append the test to `tests/CMakeLists.txt`. To build tests for abacus, set `BUILD_TESTING=1` when configuring with CMake. Executables of test programs will be under `build/tests`.
112109

113110
### Updating documentation
114111

doc/install.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ If Libxc is not installed in standard path (i.e. installed with a custom prefix
124124
cmake -B build -DLibxc_DIR=~/libxc
125125
```
126126

127-
To build tests for abacus, define `BUILD_TESTING` flag.
127+
To build tests for abacus, define `BUILD_TESTING` flag. You can also specify path to local installation of [Googletest](https://github.com/google/googletest) by setting `GTEST_DIR` flags. If not found in local, the configuration process will try to download it automatically.
128128

129129
```bash
130130
cmake -B build -DBUILD_TESTING=1
@@ -139,6 +139,8 @@ cmake --build build -j9
139139
cmake --install build
140140
```
141141

142+
`-j9` specifies the number of jobs to run simultaneously. You can change the number on your need: set to the number of CPU cores to gain the best performance.
143+
142144
[back to top](#download-and-install)
143145

144146
### Build ABACUS with make

0 commit comments

Comments
 (0)