diff --git a/Code/Mantid/Build/CMake/FindGMock.cmake b/Code/Mantid/Build/CMake/FindGMock.cmake index b62606c4e1a393c4cb2d676e8833425b2b4d49e0..11e9d1e78b1429ec36b7257e5cfa93984deb76e3 100644 --- a/Code/Mantid/Build/CMake/FindGMock.cmake +++ b/Code/Mantid/Build/CMake/FindGMock.cmake @@ -1,4 +1,22 @@ # Find the Google Mock headers and libraries +# GMOCK_INCLUDE_DIR where to find gmock.h # GMOCK_FOUND If false, do not try to use Google Mock -set ( GMOCK_FOUND FALSE ) +find_path ( GMOCK_INCLUDE_DIR gmock/gmock.h + PATHS ${PROJECT_SOURCE_DIR}/TestingTools/include + ${PROJECT_SOURCE_DIR}/../TestingTools/include +) + +find_library ( GMOCK_LIB NAMES gmock + PATHS ${PROJECT_SOURCE_DIR}/TestingTools/lib + ${PROJECT_SOURCE_DIR}/../TestingTools/lib +) + +set ( GMOCK_LIBRARIES optimized ${GMOCK_LIB} ) + +# 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 +) diff --git a/Code/Mantid/Build/CMake/FindGTest.cmake b/Code/Mantid/Build/CMake/FindGTest.cmake index 9ebed4cfb77c228bf8909d7b1a167825d31f32b9..1727981a405b5e56c70ea3848d09907acb625c1e 100644 --- a/Code/Mantid/Build/CMake/FindGTest.cmake +++ b/Code/Mantid/Build/CMake/FindGTest.cmake @@ -1,4 +1,13 @@ # Find the Google Test headers and libraries +# GTEST_INCLUDE_DIR where to find gtest.h # GTEST_FOUND If false, do not try to use Google Test -set ( GTEST_FOUND FALSE ) +find_path ( GTEST_INCLUDE_DIR gtest/gtest.h + PATHS ${PROJECT_SOURCE_DIR}/TestingTools/include + ${PROJECT_SOURCE_DIR}/../TestingTools/include +) + +# handle the QUIETLY and REQUIRED arguments and set GTEST_FOUND to TRUE if +# all listed variables are TRUE +include ( FindPackageHandleStandardArgs ) +find_package_handle_standard_args( GTest DEFAULT_MSG GTEST_INCLUDE_DIR ) diff --git a/Code/Mantid/Framework/MDAlgorithms/CMakeLists.txt b/Code/Mantid/Framework/MDAlgorithms/CMakeLists.txt index 447ea989e781581561e258027bd2590ab8844831..f9bdf9c64a0dcfbec7ddc0d340dd3ea2af23d5cd 100644 --- a/Code/Mantid/Framework/MDAlgorithms/CMakeLists.txt +++ b/Code/Mantid/Framework/MDAlgorithms/CMakeLists.txt @@ -116,8 +116,12 @@ target_link_libraries ( MDAlgorithms ${MANTIDLIBS} ) # Create test file projects if ( CXXTEST_FOUND ) if ( GMOCK_FOUND AND GTEST_FOUND ) + message ( STATUS "A: ${GMOCK_LIBRARIES}") + message ( STATUS "B: ${GMOCK_INCLUDE_DIR}") + message ( STATUS "C: ${GTEST_INCLUDE_DIR}") cxxtest_add_test ( MDAlgorithmsTest ${TEST_FILES} ${GMOCK_TEST_FILES}) - target_link_libraries( MDAlgorithmsTest MDAlgorithms MDDataObjects gmock) + target_link_libraries( MDAlgorithmsTest MDAlgorithms MDDataObjects + ${GMOCK_LIBRARIES} ) else () cxxtest_add_test ( MDAlgorithmsTest ${TEST_FILES} ) target_link_libraries( MDAlgorithmsTest MDAlgorithms MDDataObjects ) diff --git a/Code/Mantid/Framework/MDDataObjects/CMakeLists.txt b/Code/Mantid/Framework/MDDataObjects/CMakeLists.txt index d1aa9c4f6cead1e83fc57f43a928ada116f5977b..83f6bdfcc80e03bc2ccfa5047d9f8f7b19865224 100644 --- a/Code/Mantid/Framework/MDDataObjects/CMakeLists.txt +++ b/Code/Mantid/Framework/MDDataObjects/CMakeLists.txt @@ -67,7 +67,7 @@ if ( CXXTEST_FOUND ) include_directories(${HDF5_INCLUDE_DIRS} inc) if ( GMOCK_FOUND AND GTEST_FOUND ) cxxtest_add_test ( MDDataObjectsTest ${TEST_FILES} ${GMOCK_TEST_FILES} ) - target_link_libraries( MDDataObjectsTest MDDataObjects ${MANTIDLIBS} ${HDF5_LIBRARIES} gmock ) + target_link_libraries( MDDataObjectsTest MDDataObjects ${MANTIDLIBS} ${HDF5_LIBRARIES} ${GMOCK_LIBRARIES} ) else () cxxtest_add_test ( MDDataObjectsTest ${TEST_FILES} ) target_link_libraries( MDDataObjectsTest MDDataObjects ${MANTIDLIBS} ${HDF5_LIBRARIES} )