File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -36,13 +36,21 @@ function(find_and_configure_gtest VERSION)
3636 return ()
3737 endif ()
3838
39+ # Set GoogleTest-specific options
40+ set (GTEST_OPTIONS "INSTALL_GTEST ON" )
41+ if (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" )
42+ # Force PIC for GoogleTest on ARM64 to avoid relocation issues
43+ list (APPEND GTEST_OPTIONS "CMAKE_POSITION_INDEPENDENT_CODE ON" )
44+ message (STATUS "Enabling PIC for GoogleTest on ARM64" )
45+ endif ()
46+
3947 # Find or install GoogleTest
4048 CPMFindPackage(NAME GTest
4149 VERSION ${VERSION}
4250 GIT_REPOSITORY https://github.com/google/googletest.git
4351 GIT_TAG v${VERSION}
4452 GIT_SHALLOW TRUE
45- OPTIONS "INSTALL_GTEST ON"
53+ OPTIONS ${GTEST_OPTIONS}
4654 # googletest >= 1.10.0 provides a cmake config file -- use it if it exists
4755 FIND_PACKAGE_ARGUMENTS "CONFIG" )
4856 # Add GTest aliases if they don't already exist.
You can’t perform that action at this time.
0 commit comments