Skip to content

Commit

Permalink
Simplify CMakeLists.txt (#42)
Browse files Browse the repository at this point in the history
* Simplify CMakeLists.txt

The `block()` isn't needed since we can set CMake options
via. CMAKE_ARGS.

* Remove CMAKE_ARGS parameter that wasn't working.

CMAKE_ARGS isn't used when a directory is brought in via
`add_subdirectory`. Instead, variables need to be set in a block.
Additionally, the block is only needed for the
`FetchContent_MakeAvailable` call.
  • Loading branch information
camio authored Oct 8, 2024
1 parent e062cfd commit 325a07f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ include(FetchContent)
if(BUILD_TESTING)
enable_testing()

# Fetch GoogleTest
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG f8d7d77c06936315286eb55f8de22cd23c188571 # release-1.14.0
EXCLUDE_FROM_ALL
)
block()
# Disable installing google test dependency on cmake --install
set(INSTALL_GTEST OFF)

# Fetch GoogleTest
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG f8d7d77c06936315286eb55f8de22cd23c188571 # release-1.14.0
EXCLUDE_FROM_ALL CMAKE_ARGS -DBUILD_TESTING=OFF)
set(INSTALL_GTEST OFF) # Disable GoogleTest installation
set(BUILD_TESTING OFF) # Disable GoogleTest tests
FetchContent_MakeAvailable(googletest)
endblock()
endif()
Expand Down

0 comments on commit 325a07f

Please sign in to comment.