diff --git a/Framework/API/test/CMakeLists.txt b/Framework/API/test/CMakeLists.txt index b1becc957c6c2cfebf39432283d0bf7a44672210..05e00d44fb3b6236d748a5fad6887c22580af4b4 100644 --- a/Framework/API/test/CMakeLists.txt +++ b/Framework/API/test/CMakeLists.txt @@ -25,7 +25,7 @@ if ( CXXTEST_FOUND ) ${Boost_LIBRARIES} ${POCO_LIBRARIES} ${MUPARSER_LIBRARIES} - gmock ) + ${GMOCK_LIBRARIES} ) add_dependencies ( FrameworkTests APITest ) # Test data diff --git a/Framework/Algorithms/test/CMakeLists.txt b/Framework/Algorithms/test/CMakeLists.txt index ea6b5592b5cb32881f2d3a05977a00a2c333ef97..afbb274d9963dd9accc5237200ed613011e5dc0b 100644 --- a/Framework/Algorithms/test/CMakeLists.txt +++ b/Framework/Algorithms/test/CMakeLists.txt @@ -51,7 +51,7 @@ if ( CXXTEST_FOUND ) Nexus ${Boost_LIBRARIES} ${POCO_LIBRARIES} - gmock ) + ${GMOCK_LIBRARIES} ) add_dependencies ( AlgorithmsTest Crystal CurveFitting ) add_dependencies ( FrameworkTests AlgorithmsTest ) # Test data diff --git a/Framework/Beamline/test/CMakeLists.txt b/Framework/Beamline/test/CMakeLists.txt index e4c4b93c3106ca5552348b25bafeb49121a0ce24..d216fa8efa305df469d52139ac1a522df737d42f 100644 --- a/Framework/Beamline/test/CMakeLists.txt +++ b/Framework/Beamline/test/CMakeLists.txt @@ -5,7 +5,7 @@ if ( CXXTEST_FOUND ) target_link_libraries( BeamlineTest LINK_PRIVATE ${TCMALLOC_LIBRARIES_LINKTIME} Beamline ${Boost_LIBRARIES} - gmock ) + ${GMOCK_LIBRARIES} ) add_dependencies ( FrameworkTests BeamlineTest ) # Add to the 'FrameworkTests' group in VS diff --git a/Framework/Crystal/test/CMakeLists.txt b/Framework/Crystal/test/CMakeLists.txt index 56709c29ea6f9a9dcafdc5d8efaf941abdaeb95e..5c69a7f799430864fe2e52004c256e90fd34e7db 100644 --- a/Framework/Crystal/test/CMakeLists.txt +++ b/Framework/Crystal/test/CMakeLists.txt @@ -22,7 +22,7 @@ if ( CXXTEST_FOUND ) MDAlgorithms ${Boost_LIBRARIES} ${POCO_LIBRARIES} - gmock ) + ${GMOCK_LIBRARIES} ) add_dependencies ( CrystalTest Algorithms CurveFitting ) add_dependencies ( FrameworkTests CrystalTest ) # Test data diff --git a/Framework/CurveFitting/test/CMakeLists.txt b/Framework/CurveFitting/test/CMakeLists.txt index 6b920c01f3e458fbfa261c1a1f666eedb18b2233..9a850ccc050939ee3c73a0c00cf0803c4234d8a3 100644 --- a/Framework/CurveFitting/test/CMakeLists.txt +++ b/Framework/CurveFitting/test/CMakeLists.txt @@ -24,7 +24,7 @@ if ( CXXTEST_FOUND ) ${GSL_LIBRARIES} ${Boost_LIBRARIES} ${POCO_LIBRARIES} - gmock) + ${GMOCK_LIBRARIES} ) add_dependencies ( CurveFittingTest Algorithms ) add_dependencies ( FrameworkTests CurveFittingTest ) # Test data diff --git a/Framework/DataObjects/test/CMakeLists.txt b/Framework/DataObjects/test/CMakeLists.txt index f5ef54e028ed808747c716848debaef89fe6a670..692e14bfa611285d0b2b5710592de4a9484b66b7 100644 --- a/Framework/DataObjects/test/CMakeLists.txt +++ b/Framework/DataObjects/test/CMakeLists.txt @@ -27,7 +27,7 @@ if ( CXXTEST_FOUND ) ${JSONCPP_LIBRARIES} ${Boost_LIBRARIES} ${POCO_LIBRARIES} - gmock ) + ${GMOCK_LIBRARIES} ) # Specify implicit dependency, but don't link to it add_dependencies ( FrameworkTests DataObjectsTest ) # Add to the 'FrameworkTests' group in VS diff --git a/Framework/Geometry/test/CMakeLists.txt b/Framework/Geometry/test/CMakeLists.txt index cb748e4c09dfabc987cb2d5b0802005f912b033c..71d8b7e8c1cd0dfaecd8c9216bec9f53ad6e11b0 100644 --- a/Framework/Geometry/test/CMakeLists.txt +++ b/Framework/Geometry/test/CMakeLists.txt @@ -20,7 +20,7 @@ if ( CXXTEST_FOUND ) ${GSL_LIBRARIES} ${Boost_LIBRARIES} ${POCO_LIBRARIES} - gmock ) + ${GMOCK_LIBRARIES} ) add_dependencies ( FrameworkTests GeometryTest ) # Add to the 'FrameworkTests' group in VS diff --git a/Framework/HistogramData/test/CMakeLists.txt b/Framework/HistogramData/test/CMakeLists.txt index 8057c0c8c6393f8c8374f5cc44013996655ded65..a5a9c1817e65c78c755fefd265760a03ae68d615 100644 --- a/Framework/HistogramData/test/CMakeLists.txt +++ b/Framework/HistogramData/test/CMakeLists.txt @@ -5,7 +5,7 @@ if ( CXXTEST_FOUND ) target_link_libraries( HistogramDataTest LINK_PRIVATE ${TCMALLOC_LIBRARIES_LINKTIME} HistogramData ${Boost_LIBRARIES} - gmock ) + ${GMOCK_LIBRARIES} ) add_dependencies ( FrameworkTests HistogramDataTest ) # Add to the 'FrameworkTests' group in VS diff --git a/Framework/Indexing/test/CMakeLists.txt b/Framework/Indexing/test/CMakeLists.txt index 70e1d9b0f6ed4a06fb0b69235c021fda01dc69c0..b861bfe8bed0b5a2e4ec7aacc28d0752560bca1f 100644 --- a/Framework/Indexing/test/CMakeLists.txt +++ b/Framework/Indexing/test/CMakeLists.txt @@ -5,7 +5,7 @@ if ( CXXTEST_FOUND ) target_link_libraries( IndexingTest LINK_PRIVATE ${TCMALLOC_LIBRARIES_LINKTIME} Indexing ${Boost_LIBRARIES} - gmock ) + ${GMOCK_LIBRARIES} ) add_dependencies ( FrameworkTests IndexingTest ) # Add to the 'FrameworkTests' group in VS diff --git a/Framework/Kernel/test/CMakeLists.txt b/Framework/Kernel/test/CMakeLists.txt index f6a79b4db35295aaf85758ec0ea3b00cf23fcab8..5a8db34bbebed64a4e99abc77778893c14b2008b 100644 --- a/Framework/Kernel/test/CMakeLists.txt +++ b/Framework/Kernel/test/CMakeLists.txt @@ -14,7 +14,7 @@ if ( CXXTEST_FOUND ) ${NEXUS_LIBRARIES} ${Boost_LIBRARIES} ${POCO_LIBRARIES} - gmock + ${GMOCK_LIBRARIES} ${JSONCPP_LIBRARIES} ${TBB_LIBRARIES} ${TBB_MALLOC_LIBRARIES} diff --git a/Framework/MDAlgorithms/test/CMakeLists.txt b/Framework/MDAlgorithms/test/CMakeLists.txt index 67fe7686bc148e5188ebd23cd0b9ae3a0a959b71..39603ebb06749cb5d4121a1b34cd19265916dd6b 100644 --- a/Framework/MDAlgorithms/test/CMakeLists.txt +++ b/Framework/MDAlgorithms/test/CMakeLists.txt @@ -28,7 +28,7 @@ if ( CXXTEST_FOUND ) ${Boost_LIBRARIES} ${POCO_LIBRARIES} ${MUPARSER_LIBRARIES} - gmock + ${GMOCK_LIBRARIES} ${NEXUS_LIBRARIES} ${HDF5_LIBRARIES} ) diff --git a/Framework/RemoteAlgorithms/test/CMakeLists.txt b/Framework/RemoteAlgorithms/test/CMakeLists.txt index 19598925cecc97120a28249556aafbbaa36635b9..b597f37db0cf737d56d297a6913b6802dd343d47 100644 --- a/Framework/RemoteAlgorithms/test/CMakeLists.txt +++ b/Framework/RemoteAlgorithms/test/CMakeLists.txt @@ -9,7 +9,7 @@ if ( CXXTEST_FOUND ) RemoteAlgorithms ${Boost_LIBRARIES} ${POCO_LIBRARIES} - gmock ) + ${GMOCK_LIBRARIES} ) add_dependencies ( FrameworkTests RemoteAlgorithmsTest ) # Test data. Not using any for now. Remember to uncomment if data is added for these remote alg. tests # add_dependencies ( RemoteAlgorithmsTest StandardTestData ) diff --git a/Framework/RemoteJobManagers/test/CMakeLists.txt b/Framework/RemoteJobManagers/test/CMakeLists.txt index 786b1a890acf7d82b762f31223eb6cf3866e9728..fc66b01d6deabbf27bb677fb1ea23ac94e41cba8 100644 --- a/Framework/RemoteJobManagers/test/CMakeLists.txt +++ b/Framework/RemoteJobManagers/test/CMakeLists.txt @@ -8,7 +8,7 @@ if ( CXXTEST_FOUND ) RemoteJobManagers ${Boost_LIBRARIES} ${POCO_LIBRARIES} - gmock ) + ${GMOCK_LIBRARIES} ) add_dependencies ( FrameworkTests RemoteJobManagersTest ) # Test data. Not using any for now. Remember to uncomment if data is added for these remote job managers # add_dependencies ( RemoteJobManagersTest StandardTestData ) diff --git a/Framework/SINQ/test/CMakeLists.txt b/Framework/SINQ/test/CMakeLists.txt index ad0eb38d9a2b6780555241251ba1437714e9a35b..20a9d10956aaf3100469867de94805a2012a5869 100644 --- a/Framework/SINQ/test/CMakeLists.txt +++ b/Framework/SINQ/test/CMakeLists.txt @@ -16,7 +16,7 @@ if ( CXXTEST_FOUND ) SINQ CurveFitting ${MANTIDLIBS} - gmock ) + ${GMOCK_LIBRARIES} ) # Test data add_dependencies ( PSISINQTest StandardTestData ) diff --git a/Framework/ScriptRepository/test/CMakeLists.txt b/Framework/ScriptRepository/test/CMakeLists.txt index be55bbca03749ef1446fa87e33d5a7bad3eff5b5..24b5adfef3704131e064b18d3728e9fb9fdca96d 100644 --- a/Framework/ScriptRepository/test/CMakeLists.txt +++ b/Framework/ScriptRepository/test/CMakeLists.txt @@ -11,7 +11,7 @@ if ( CXXTEST_FOUND ) ScriptRepository ${Boost_LIBRARIES} ${POCO_LIBRARIES} - gmock ) + ${GMOCK_LIBRARIES} ) add_dependencies ( FrameworkTests ScriptRepositoryTest ) # Add to the 'FrameworkTests' group in VS diff --git a/Framework/Types/test/CMakeLists.txt b/Framework/Types/test/CMakeLists.txt index cc897240132050e3746773f7fafae87b8d6db777..751e4834b0e99ef1c49b0ee9f6175144353a15fd 100644 --- a/Framework/Types/test/CMakeLists.txt +++ b/Framework/Types/test/CMakeLists.txt @@ -4,7 +4,7 @@ if ( CXXTEST_FOUND ) cxxtest_add_test ( TypesTest ${TEST_FILES} ${GMOCK_TEST_FILES}) target_link_libraries( TypesTest LINK_PRIVATE ${TCMALLOC_LIBRARIES_LINKTIME} ${Boost_LIBRARIES} - gmock ) + ${GMOCK_LIBRARIES} ) add_dependencies ( FrameworkTests TypesTest ) # Add to the 'FrameworkTests' group in VS diff --git a/MantidQt/API/test/CMakeLists.txt b/MantidQt/API/test/CMakeLists.txt index 1664ff66064ed3d0ea065a3f051336787975cd99..eb8e92a6b549105fcc7c1f3bc77e5451d5123a0d 100644 --- a/MantidQt/API/test/CMakeLists.txt +++ b/MantidQt/API/test/CMakeLists.txt @@ -25,7 +25,7 @@ if ( CXXTEST_FOUND ) ${QWT_LIBRARIES} ${Boost_LIBRARIES} ${POCO_LIBRARIES} - gmock ) + ${GMOCK_LIBRARIES} ) add_dependencies( GUITests MantidQtAPITest ) # Add to the 'UnitTests' group in VS diff --git a/MantidQt/CustomInterfaces/test/CMakeLists.txt b/MantidQt/CustomInterfaces/test/CMakeLists.txt index 01f2756fb28bf1ea180e356b53cf176c787351f9..5d5d30c3ce98c8501398c0b7bb99305672a952c0 100644 --- a/MantidQt/CustomInterfaces/test/CMakeLists.txt +++ b/MantidQt/CustomInterfaces/test/CMakeLists.txt @@ -24,7 +24,7 @@ if ( CXXTEST_FOUND ) ${POCO_LIBRARIES} ${QWT_LIBRARIES} ${QT_LIBRARIES} - gmock ) + ${GMOCK_LIBRARIES} ) add_dependencies( CustomInterfacesTest MDAlgorithms ) # Test data diff --git a/MantidQt/MantidWidgets/test/CMakeLists.txt b/MantidQt/MantidWidgets/test/CMakeLists.txt index a1edb04c7497e6a36877cff091644d4f7ae95571..bfbac70ad00c82529ff6dc1329aebf61e4441ed4 100644 --- a/MantidQt/MantidWidgets/test/CMakeLists.txt +++ b/MantidQt/MantidWidgets/test/CMakeLists.txt @@ -19,7 +19,7 @@ if ( CXXTEST_FOUND ) ${QT_LIBRARIES} ${Boost_LIBRARIES} ${POCO_LIBRARIES} - gmock + ${GMOCK_LIBRARIES} ) # Add to the 'UnitTests' group in VS diff --git a/MantidQt/SliceViewer/CMakeLists.txt b/MantidQt/SliceViewer/CMakeLists.txt index 10ecb5a53d532413816bf48018c26f47d71c05bb..e6605ffb07768940e65a86f794301988ed940f82 100644 --- a/MantidQt/SliceViewer/CMakeLists.txt +++ b/MantidQt/SliceViewer/CMakeLists.txt @@ -200,7 +200,7 @@ if ( CXXTEST_FOUND ) ${Boost_LIBRARIES} ${POCO_LIBRARIES} ${QT_LIBRARIES} - gmock ) + ${GMOCK_LIBRARIES} ) add_dependencies( GUITests SliceViewerTest ) # Add to the 'UnitTests' group in VS diff --git a/MantidQt/SliceViewer/test/CMakeLists.txt b/MantidQt/SliceViewer/test/CMakeLists.txt index ec6ef6fa337ab6f519fe00769f3c1f2d7b288412..5061fd18eebfba14cc1c45dab9f31f3dbb9da29b 100644 --- a/MantidQt/SliceViewer/test/CMakeLists.txt +++ b/MantidQt/SliceViewer/test/CMakeLists.txt @@ -26,7 +26,7 @@ if ( CXXTEST_FOUND ) ${QWT_LIBRARIES} ${Boost_LIBRARIES} ${POCO_LIBRARIES} - gmock ) + ${GMOCK_LIBRARIES} ) add_dependencies( GUITests SliceViewerTest ) diff --git a/Vates/VatesAPI/CMakeLists.txt b/Vates/VatesAPI/CMakeLists.txt index 5acc60f617b7307037630340f6f09b9e7bd2bac4..6c3bc24731c8c7f84b53d63e11bdd99100ae5a25 100644 --- a/Vates/VatesAPI/CMakeLists.txt +++ b/Vates/VatesAPI/CMakeLists.txt @@ -267,7 +267,7 @@ target_link_libraries( VatesAPITest LINK_PRIVATE ${TCMALLOC_LIBRARIES_LINKTIME} ${vtkjsoncpp_LIBRARIES} ${POCO_LIBRARIES} ${Boost_LIBRARIES} - gmock + ${GMOCK_LIBRARIES} ${QWT_LIBRARIES} Qt4::QtCore ) diff --git a/Vates/VatesSimpleGui/ViewWidgets/CMakeLists.txt b/Vates/VatesSimpleGui/ViewWidgets/CMakeLists.txt index 677e5985d5e1b7ec72622431c0a13c6d2d2c4f38..bd36633fb7edc239ebe1487f9dfc4efff5f2cf54 100644 --- a/Vates/VatesSimpleGui/ViewWidgets/CMakeLists.txt +++ b/Vates/VatesSimpleGui/ViewWidgets/CMakeLists.txt @@ -177,7 +177,7 @@ target_link_libraries( VatesSimpleGuiViewWidgetsTest LINK_PRIVATE ${TCMALLOC_LIB ${MANTID_SUBPROJECT_LIBS} ${POCO_LIBRARIES} ${Boost_LIBRARIES} - gmock ) + ${GMOCK_LIBRARIES} ) add_dependencies( AllTests VatesSimpleGuiViewWidgetsTest ) # Add to the 'UnitTests' group in VS diff --git a/buildconfig/CMake/FindGMock.cmake b/buildconfig/CMake/FindGMock.cmake index 753b1012113278ef48a8ecc519a83fd97278f2cc..39cfb905dec5b5f31efd65501dafdd0f4779d59e 100644 --- a/buildconfig/CMake/FindGMock.cmake +++ b/buildconfig/CMake/FindGMock.cmake @@ -8,7 +8,7 @@ set (gtest_version "1.7.0" CACHE INTERNAL "") option(USE_SYSTEM_GTEST "Use the system installed GTest - v${gtest_version}?" OFF) if(USE_SYSTEM_GTEST) - message(STATUS "Using system gtest") + message(STATUS "Using system gtest - currently untested") find_package(GTest ${gtest_version} EXACT REQUIRED) find_package(GMock ${gtest_version} EXACT REQUIRED) else() @@ -51,6 +51,13 @@ else() FOLDER "UnitTests/gmock" ) endforeach() + set( GMOCK_LIB gmock ) + set( GMOCK_LIB_DEBUG gmock ) + set( GMOCK_LIBRARIES optimized ${GMOCK_LIB} debug ${GMOCK_LIB_DEBUG} ) + set( GTEST_LIB gtest ) + set( GTEST_LIB_DEBUG gtest ) + set( GTEST_LIBRARIES optimized ${GTEST_LIB} debug ${GTEST_LIB_DEBUG} ) + find_path ( GMOCK_INCLUDE_DIR gmock/gmock.h PATHS ${CMAKE_BINARY_DIR}/googletest-src/gmock/include NO_DEFAULT_PATH ) @@ -58,5 +65,15 @@ else() PATHS ${CMAKE_BINARY_DIR}/googletest-src/gtest/include NO_DEFAULT_PATH ) - mark_as_advanced ( GMOCK_INCLUDE_DIR GTEST_INCLUDE_DIR ) + + # handle the QUIETLY and REQUIRED arguments and set GMOCK_FOUND to TRUE if + # all listed variables are TRUE + include ( FindPackageHandleStandardArgs ) + find_package_handle_standard_args( GMOCK DEFAULT_MSG GMOCK_INCLUDE_DIR + GMOCK_LIBRARIES ) + find_package_handle_standard_args( GTEST DEFAULT_MSG GTEST_INCLUDE_DIR + GTEST_LIBRARIES ) + + mark_as_advanced ( GMOCK_INCLUDE_DIR GMOCK_LIB GMOCK_LIB_DEBUG ) + mark_as_advanced ( GTEST_INCLUDE_DIR GTEST_LIB GTEST_LIB_DEBUG ) endif()