Skip to content
Snippets Groups Projects
Commit ecf8cd87 authored by Michael Reuter's avatar Michael Reuter
Browse files

Attempt to get GMock/GTest into CMake for real. Headers and libgmock generate...

Attempt to get GMock/GTest into CMake for real. Headers and libgmock generate a huge number of linker errors that look to be self-inflicted, so test compilation fails. No working solution found. This refs #1881.
parent 1a10ee7c
No related branches found
No related tags found
No related merge requests found
# 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
)
# 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 )
......@@ -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 )
......
......@@ -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} )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment