Tests: Add FREECAD_USE_EXTERNAL_GTEST cmake option (#21190)
Add FREECAD_USE_EXTERNAL_GTEST cmake option and fix build with external libraries
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
if ( EXISTS "${CMAKE_SOURCE_DIR}/tests/lib/googletest" )
|
||||
include_directories( ${CMAKE_SOURCE_DIR}/tests/lib/googletest/include/ )
|
||||
include_directories( ${CMAKE_SOURCE_DIR}/tests/lib/googlemock/include/ )
|
||||
if(FREECAD_USE_EXTERNAL_GTEST)
|
||||
find_package(GTest REQUIRED)
|
||||
set(Google_Tests_LIBS ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES})
|
||||
else()
|
||||
find_package(GTest)
|
||||
if( GTest_FOUND )
|
||||
message( STATUS "Found Google Test: version ${GTest_VERSION}" )
|
||||
if ( EXISTS "${CMAKE_SOURCE_DIR}/tests/lib/googletest" )
|
||||
include_directories( ${CMAKE_SOURCE_DIR}/tests/lib/googletest/include/ )
|
||||
include_directories( ${CMAKE_SOURCE_DIR}/tests/lib/googlemock/include/ )
|
||||
else()
|
||||
message( SEND_ERROR "The Google Test submodule is not available. Please run git submodule update --init" )
|
||||
endif()
|
||||
@@ -124,7 +124,7 @@ foreach (exe ${TestExecutables})
|
||||
add_executable(${exe})
|
||||
endforeach()
|
||||
|
||||
if ( EXISTS "${CMAKE_SOURCE_DIR}/tests/lib/googletest" )
|
||||
if ( NOT FREECAD_USE_EXTERNAL_GTEST )
|
||||
add_subdirectory(lib)
|
||||
endif()
|
||||
add_subdirectory(src)
|
||||
|
||||
Reference in New Issue
Block a user