Closed camio closed 1 month ago
This, surprisingly, didn't work as gtest files are being installed again with this change.
@camio Are you using the necessary version of CMake (3.30+
)? It could be that we also need to change cmake_minimum_required(VERSION 3.25)
to cmake_minimum_required(VERSION 3.25...3.30.4)
to properly set all the policies.
I don't see this being supported?
Use of CMAKE_ARGS is not mentioned in the fetch content documentation.
Yes it's not supported, see: https://discourse.cmake.org/t/fetchcontent-declare-with-cmake-args-does-not-work/11227/7
Nice catch @wusatosi !
Okay, I think I figured this out. Thanks @wusatosi and @DeveloperPaul123 for your help.
CMAKE_ARGS
is ignored by FetchContent_Declare
. The documentation states "The configure, build, install, and test steps are explicitly disabled, so options related to those steps will be ignored." and CMAKE_ARGS
is listed as a "configure" option.add_subdirectory
call is made in FetchContent_MakeAvailable
so it makes sense to have the FetchContent_Declare
call outside of the block.CMAKE_ARGS
to disable BUILD_TESTING
appeared to work only because GoogleTest disables tests by default and uses a different variable to control testing.BUILD_TESTING
doesn't do anything in this case, I think we should keep it there as other dependency projects will use the standard variable for this.@wusatosi , @DeveloperPaul123 can you give this PR another look now? I've verified in the CI output that this works as expected.
The
block()
isn't needed since we can set CMake options via. CMAKE_ARGS.