|
|
b2cd752 |
diff -ur root-6.22.00.orig/cmake/modules/SearchInstalledSoftware.cmake root-6.22.00/cmake/modules/SearchInstalledSoftware.cmake
|
|
|
b2cd752 |
--- root-6.22.00.orig/cmake/modules/SearchInstalledSoftware.cmake 2020-06-14 17:51:48.000000000 +0200
|
|
|
b2cd752 |
+++ root-6.22.00/cmake/modules/SearchInstalledSoftware.cmake 2020-06-21 18:29:13.973655810 +0200
|
|
|
b2cd752 |
@@ -1592,100 +1592,17 @@
|
|
|
7236b9a |
|
|
|
7236b9a |
#---Download googletest--------------------------------------------------------------
|
|
|
7236b9a |
if (testing)
|
|
|
7236b9a |
- # FIXME: Remove our version of gtest in roottest. We can reuse this one.
|
|
|
ea40f6d |
- # Add googletest
|
|
|
7236b9a |
- # http://stackoverflow.com/questions/9689183/cmake-googletest
|
|
|
ea40f6d |
+ # Workaround for missing libraries in Fedora's gmock packaging < 1.8.0
|
|
|
ea40f6d |
+ if(EXISTS ${CMAKE_SOURCE_DIR}/googlemock)
|
|
|
ea40f6d |
+ set(_G_LIBRARY_PATH ${CMAKE_SOURCE_DIR}/googlemock)
|
|
|
ea40f6d |
|
|
|
ea40f6d |
- set(_gtest_byproduct_binary_dir
|
|
|
b2cd752 |
- ${CMAKE_CURRENT_BINARY_DIR}/googletest-prefix/src/googletest-build)
|
|
|
ea40f6d |
- set(_gtest_byproducts
|
|
|
b2cd752 |
- ${_gtest_byproduct_binary_dir}/lib/libgtest.a
|
|
|
b2cd752 |
- ${_gtest_byproduct_binary_dir}/lib/libgtest_main.a
|
|
|
b2cd752 |
- ${_gtest_byproduct_binary_dir}/lib/libgmock.a
|
|
|
b2cd752 |
- ${_gtest_byproduct_binary_dir}/lib/libgmock_main.a
|
|
|
7236b9a |
- )
|
|
|
7236b9a |
-
|
|
|
ea40f6d |
- if(MSVC)
|
|
|
ea40f6d |
- set(EXTRA_GTEST_OPTS
|
|
|
b2cd752 |
- -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG:PATH=${_gtest_byproduct_binary_dir}/lib/
|
|
|
b2cd752 |
- -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL:PATH=${_gtest_byproduct_binary_dir}/lib/
|
|
|
b2cd752 |
- -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE:PATH=${_gtest_byproduct_binary_dir}/lib/
|
|
|
b2cd752 |
- -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO:PATH=${_gtest_byproduct_binary_dir}/lib/
|
|
|
b2cd752 |
- -Dgtest_force_shared_crt=ON
|
|
|
b2cd752 |
- BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --config Release)
|
|
|
ea40f6d |
- endif()
|
|
|
436670d |
- if(APPLE)
|
|
|
436670d |
- set(EXTRA_GTEST_OPTS
|
|
|
436670d |
- -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT})
|
|
|
436670d |
- endif()
|
|
|
ea40f6d |
-
|
|
|
7236b9a |
- ExternalProject_Add(
|
|
|
7236b9a |
- googletest
|
|
|
7236b9a |
- GIT_REPOSITORY https://github.com/google/googletest.git
|
|
|
fba7139 |
- GIT_SHALLOW 1
|
|
|
b2cd752 |
- GIT_TAG release-1.10.0
|
|
|
7236b9a |
- UPDATE_COMMAND ""
|
|
|
7236b9a |
- # TIMEOUT 10
|
|
|
7236b9a |
- # # Force separate output paths for debug and release builds to allow easy
|
|
|
7236b9a |
- # # identification of correct lib in subsequent TARGET_LINK_LIBRARIES commands
|
|
|
7236b9a |
- # CMAKE_ARGS -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG:PATH=DebugLibs
|
|
|
7236b9a |
- # -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE:PATH=ReleaseLibs
|
|
|
7236b9a |
- # -Dgtest_force_shared_crt=ON
|
|
|
7236b9a |
- CMAKE_ARGS -G ${CMAKE_GENERATOR}
|
|
|
b2cd752 |
- -DCMAKE_BUILD_TYPE=Release
|
|
|
7236b9a |
- -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
|
|
7236b9a |
- -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
|
|
|
7236b9a |
- -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
|
|
b2cd752 |
- -DCMAKE_CXX_FLAGS=${ROOT_EXTERNAL_CXX_FLAGS}
|
|
|
b8c8500 |
- -DCMAKE_AR=${CMAKE_AR}
|
|
|
7236b9a |
- -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
|
|
|
ea40f6d |
- ${EXTRA_GTEST_OPTS}
|
|
|
7236b9a |
- # Disable install step
|
|
|
7236b9a |
- INSTALL_COMMAND ""
|
|
|
ea40f6d |
- BUILD_BYPRODUCTS ${_gtest_byproducts}
|
|
|
7236b9a |
- # Wrap download, configure and build steps in a script to log output
|
|
|
7236b9a |
- LOG_DOWNLOAD ON
|
|
|
7236b9a |
- LOG_CONFIGURE ON
|
|
|
7236b9a |
- LOG_BUILD ON)
|
|
|
7236b9a |
-
|
|
|
7236b9a |
- # Specify include dirs for gtest and gmock
|
|
|
7236b9a |
- ExternalProject_Get_Property(googletest source_dir)
|
|
|
7236b9a |
- set(GTEST_INCLUDE_DIR ${source_dir}/googletest/include)
|
|
|
7236b9a |
- set(GMOCK_INCLUDE_DIR ${source_dir}/googlemock/include)
|
|
|
b2cd752 |
- # Create the directories. Prevents bug https://gitlab.kitware.com/cmake/cmake/issues/15052
|
|
|
b2cd752 |
- file(MAKE_DIRECTORY ${GTEST_INCLUDE_DIR} ${GMOCK_INCLUDE_DIR})
|
|
|
7236b9a |
-
|
|
|
7236b9a |
- # Libraries
|
|
|
7236b9a |
- ExternalProject_Get_Property(googletest binary_dir)
|
|
|
b2cd752 |
- set(_G_LIBRARY_PATH ${binary_dir}/lib/)
|
|
|
7236b9a |
-
|
|
|
b2cd752 |
- # Use gmock_main instead of gtest_main because it initializes gtest as well.
|
|
|
b2cd752 |
- # Note: The libraries are listed in reverse order of their dependancies.
|
|
|
b2cd752 |
- foreach(lib gtest gtest_main gmock gmock_main)
|
|
|
b2cd752 |
+ foreach(lib gmock gmock_main)
|
|
|
ea40f6d |
add_library(${lib} IMPORTED STATIC GLOBAL)
|
|
|
b2cd752 |
- set_target_properties(${lib} PROPERTIES
|
|
|
b2cd752 |
- IMPORTED_LOCATION "${_G_LIBRARY_PATH}${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
|
|
b2cd752 |
- INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIRS}"
|
|
|
b2cd752 |
- )
|
|
|
ea40f6d |
- add_dependencies(${lib} googletest)
|
|
|
aff214e |
- if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND
|
|
|
aff214e |
- ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER_EQUAL 9)
|
|
|
aff214e |
- target_compile_options(${lib} INTERFACE -Wno-deprecated-copy)
|
|
|
aff214e |
- endif()
|
|
|
ea40f6d |
endforeach()
|
|
|
b2cd752 |
- # Once we require at least cmake 3.11, target_include_directories will work for imported targets
|
|
|
b2cd752 |
- # Because of https://gitlab.kitware.com/cmake/cmake/-/merge_requests/1264
|
|
|
b2cd752 |
- # We need this workaround:
|
|
|
b2cd752 |
- SET_PROPERTY(TARGET gtest APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${GTEST_INCLUDE_DIR})
|
|
|
b2cd752 |
- SET_PROPERTY(TARGET gmock APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${GMOCK_INCLUDE_DIR})
|
|
|
b2cd752 |
- #target_include_directories(gtest INTERFACE ${GTEST_INCLUDE_DIR})
|
|
|
b2cd752 |
- #target_include_directories(gmock INTERFACE ${GMOCK_INCLUDE_DIR})
|
|
|
b2cd752 |
-
|
|
|
b2cd752 |
- set_property(TARGET gtest PROPERTY IMPORTED_LOCATION ${_G_LIBRARY_PATH}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX})
|
|
|
b2cd752 |
- set_property(TARGET gtest_main PROPERTY IMPORTED_LOCATION ${_G_LIBRARY_PATH}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX})
|
|
|
ea40f6d |
set_property(TARGET gmock PROPERTY IMPORTED_LOCATION ${_G_LIBRARY_PATH}/${CMAKE_STATIC_LIBRARY_PREFIX}gmock${CMAKE_STATIC_LIBRARY_SUFFIX})
|
|
|
ea40f6d |
set_property(TARGET gmock_main PROPERTY IMPORTED_LOCATION ${_G_LIBRARY_PATH}/${CMAKE_STATIC_LIBRARY_PREFIX}gmock_main${CMAKE_STATIC_LIBRARY_SUFFIX})
|
|
|
7236b9a |
|
|
|
055702a |
+ endif()
|
|
|
7236b9a |
endif()
|
|
|
7236b9a |
|
|
|
aff214e |
#------------------------------------------------------------------------------------
|