Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add googletest #3672

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

add googletest #3672

wants to merge 3 commits into from

Conversation

shaomeng
Copy link
Contributor

This PR adds GoogleTest into the CMake system, and also tests the behavior of ptr_cache.hpp.

It introduces a new build option, BUILD_GOOGLE_TEST. When it's set to TRUE, a test app will be build in the build directory:
googletest_scripts

To run this test, one can either invoke it directly: ./googletest_scripts/ptr_cache_test, or run a single ctest command: ctest . . The latter is convenient when a lot of unit test programs are there.

@ifranda Please let me know if you have any questions!

@shaomeng shaomeng requested a review from ifranda October 12, 2024 04:00
@ifranda
Copy link
Collaborator

ifranda commented Oct 12, 2024

Sounds great, thanks! Is the process like this?

cd ~/VAPOR
mkdir build
cd build
cmake -DBUILD_GOOGLE_TEST=ON ..

This creates some files, but also outputs this:

ifranda@casper-login2:~/VAPOR/build> cmake -DBUILD_GOOGLE_TEST=ON ..
CMAKE_BUILD_TYPE Debug
CMake Error at /usr/share/cmake/Modules/FetchContent.cmake:690 (message):
  No content details recorded for googletest
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FetchContent.cmake:1064 (__FetchContent_getSavedDetails)
  /usr/share/cmake/Modules/FetchContent.cmake:1184 (FetchContent_Populate)
  CMakeLists.txt:141 (FetchContent_MakeAvailable)


-- Configuring incomplete, errors occurred!
See also "/glade/u/home/ifranda/VAPOR/build/CMakeFiles/CMakeOutput.log".

@shaomeng
Copy link
Contributor Author

Hey @ifranda , can you do the following and retry? I think 2) is probably the cause.

  1. delete all the content of the build directory, and
  2. use "module load cmake" to load a newer version of cmake

@ifranda
Copy link
Collaborator

ifranda commented Oct 12, 2024

module load cmake did the trick!

Copy link
Collaborator

@ifranda ifranda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

CMakeLists.txt Outdated
FetchContent_Declare( googletest
URL https://github.com/google/googletest/archive/refs/heads/main.zip
DOWNLOAD_EXTRACT_TIMESTAMP NEW )
endif()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ifranda , could you remove the if() and endif() lines (line 132 and 136) for me? The CMake version should be specified at the beginning of the CMakeLists.txt (Line 7, cmake_minimum_required()) function, instead of here.

(I lost my access to update this PR.)

@ifranda
Copy link
Collaborator

ifranda commented Oct 12, 2024

Sure! I’m not at my computer right now but I’ll update it tonight or tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants