Skip to content

Commit 135afeb

Browse files
Merge pull request #22 from andersc/master
move GoogleTest to CMake
2 parents 4c99a2b + a9edfbb commit 135afeb

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

.github/workflows/efp_base_macos.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ jobs:
1212
runs-on: macos-latest
1313

1414
steps:
15-
- uses: actions/checkout@v3
16-
- name: Install GTest
17-
run: brew install googletest
15+
- uses: actions/checkout@v4
1816
- name: CMake set-up
1917
run: cmake -DCMAKE_BUILD_TYPE=Release .
2018
- name: make

.github/workflows/efp_base_ubuntu.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ jobs:
1313

1414
steps:
1515
- uses: actions/checkout@v3
16-
- name: Install GTest
17-
run: sudo apt install libgtest-dev
1816
- name: CMake set-up
1917
run: cmake -DCMAKE_BUILD_TYPE=Release .
2018
- name: make

.github/workflows/efp_base_win.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ jobs:
1212
runs-on: windows-latest
1313

1414
steps:
15-
- name: Install gtest
16-
uses: MarkusJx/googletest-installer@v1.1
17-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1816
- name: CMake set-up
19-
run: cmake -S . `-D CMAKE_BUILD_TYPE=Release -D GTEST_ROOT=D:/gtest`
17+
run: cmake -S . `-D CMAKE_BUILD_TYPE=Release`
2018
- name: make
2119
run: cmake --build . --config Release

CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
1212
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
1313

1414
find_package(Threads REQUIRED)
15-
find_package(GTest REQUIRED)
1615

17-
if(WIN32)
18-
set(CMAKE_CXX_FLAGS_RELEASE "/MT")
19-
set(CMAKE_CXX_FLAGS_DEBUG "/MTd")
20-
endif()
16+
include(FetchContent)
17+
FetchContent_Declare(googletest
18+
GIT_REPOSITORY https://github.com/google/googletest.git
19+
GIT_TAG v1.16.0)
20+
# For Windows: Prevent overriding the parent project's compiler/linker settings
21+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
22+
FetchContent_MakeAvailable(googletest)
23+
enable_testing()
2124

2225
add_library(efp STATIC ElasticFrameProtocol.cpp)
2326
add_library(efp_shared SHARED ElasticFrameProtocol.cpp)

0 commit comments

Comments
 (0)