Commit 4bdc2adc authored by chrisrogers1234's avatar chrisrogers1234
Browse files

Clean up on gitignore, add FindGTest.cmake

parent c06c279e
......@@ -130,15 +130,17 @@ src/ValueDefinitions/cmake_install.cmake
src/cmake_install.cmake
src/config.h
src/opal
src/libOPAL.a
ippl/src/libippl.a
ippl/IPPLConfig_install.cmake
*~
/Debug/
src/opal_unit_tests
src/unit_tests/CMakeFiles/
src/unit_tests/Makefile
src/unit_tests/classic_src/Fields/Interpolation/PolynomialVectorTest.cpp_
src/unit_tests/cmake_install.cmake
src/unit_tests/gtest/include/
src/unit_tests/gtest/lib/
src/unit_tests/gtest/src/
*CMakeFiles/
*Makefile
*cmake_install.cmake
tests/tools/gtest
tests/opal_unit_tests
......@@ -35,10 +35,9 @@ elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "4.7.3")
message (FATAL_ERROR "To build OPAL you need GCC version 4.7.3 or greater")
message (FATAL_ERROR "To build OPAL you need GCC version 4.7.3 or greater")
elseif (${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER "4.7.2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wno-reorder -Wno-unused-local-typedefs -Werror=unused-variable -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wno-reorder -Wno-unused-local-typedefs -Werror=unused-variable -std=c++11")
endif ()
else ()
message (STATUS "Unknown C++ compiler. Please use the GNU or Intel compiler, IF you are having problems.")
......@@ -203,11 +202,6 @@ ADD_SUBDIRECTORY (classic/5.0/src)
ADD_SUBDIRECTORY (src)
IF (BUILD_OPAL_UNIT_TESTS)
FIND_PACKAGE (GTest REQUIRED)
# touch CMakeLists to force cmake to redo the glob for new test source files
# otherwise cmake does not detect new source files
EXECUTE_PROCESS(COMMAND touch ${CMAKE_CURRENT_SOURCE_DIR}/tests/CMakeLists.txt)
ADD_SUBDIRECTORY(tests)
ADD_SUBDIRECTORY(tests)
ENDIF (BUILD_OPAL_UNIT_TESTS)
ENDIF (BUILD_OPAL_UNIT_TESTS)
\ No newline at end of file
#
# Find gtest Google Test includes and library
#
# gtest
# It can be found at:
# http://amas.web.psi.ch/tools/GSL/index.html
#
# GTEST_INCLUDE_DIR - where to find gtest/gtest.h
# GTEST_LIBRARY - libgtest.a path
# GTEST_MAIN_LIBRARY - libgtest_main.a path
# GTEST_FOUND - do not attempt to use if "no" or undefined.
FIND_PATH(GTEST_INCLUDE_DIR gtest/gtest.h
HINTS $ENV{GTEST_INCLUDE_PATH} $ENV{GTEST_INCLUDE_DIR} $ENV{GTEST_PREFIX}/include $ENV{GTEST_DIR}/include tests/tools/gtest/include
PATHS ENV CPP_INCLUDE_PATH
)
FIND_LIBRARY(GTEST_LIBRARY gtest
HINTS $ENV{GTEST_LIBRARY_PATH} $ENV{GTEST_LIBRARY_DIR} $ENV{GTEST_PREFIX}/lib $ENV{GSL_DIR}/lib $ENV{GTEST}/lib tests/tools/gtest/lib
PATHS ENV LIBRARY_PATH
)
FIND_LIBRARY(GTEST_LIBRARY_MAIN gtest_main
HINTS $ENV{GTEST_LIBRARY_PATH} $ENV{GTEST_LIBRARY_DIR} $ENV{GTEST_PREFIX}/lib $ENV{GSL_DIR}/lib $ENV{GTEST}/lib tests/tools/gtest/lib
PATHS ENV LIBRARY_PATH
)
set( GTEST_BOTH_LIBRARIES
${GTEST_LIBRARY}
${GTEST_LIBRARY_MAIN}
)
IF(GTEST_INCLUDE_DIR AND GTEST_LIBRARY)
SET( GTEST_FOUND "YES" )
ENDIF(GTEST_INCLUDE_DIR AND GTEST_LIBRARY)
IF (GTEST_FOUND)
IF (NOT GTEST_FIND_QUIETLY)
MESSAGE(STATUS "Found gtest libraries: ${GTEST_BOTH_LIBRARIES}")
MESSAGE(STATUS "Found gtest include dir: ${GTEST_INCLUDE_DIR}")
ENDIF (NOT GTEST_FIND_QUIETLY)
ELSE (GTEST_FOUND)
IF (GTest_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find GTEST!")
ENDIF (GTest_FIND_REQUIRED)
ENDIF (GTEST_FOUND)
cmake_minimum_required(VERSION 2.6)
FIND_PACKAGE (GTest REQUIRED)
set (TEST_EXE opal_unit_tests)
set (SRC_DIRS classic_src opal_src)
......@@ -51,6 +52,7 @@ INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIR}
${Trilinos_TPL_INCLUDE_DIRS}
${IPPL_SOURCE_DIRS}
${CCSE_INCLUDE_DIRS}
${GTest_INCLUDE_DIRS}
)
# Check to see if cmake finds the test files
......@@ -59,4 +61,4 @@ INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIR}
# Build the test exe. We don't do an install on the unit test exe as it is
# assumed that this is internal to opal
ADD_EXECUTABLE(${TEST_EXE} ${TEST_SRCS}) # the opal and classic sources are not needed again if we link agains libOPAL and libCLASSIC!
TARGET_LINK_LIBRARIES(${TEST_EXE} OPALib CLASSIC ${OPAL_LIBS} ${Trilinos_LIBRARIES} ${Trilinos_TPL_LIBRARIES} ${CCSE_LIBRARIES} -lgfortran ${OTHER_CMAKE_EXE_LINKER_FLAGS} ${GTEST_BOTH_LIBRARIES} -lpthread)
\ No newline at end of file
TARGET_LINK_LIBRARIES(${TEST_EXE} OPALib CLASSIC ${OPAL_LIBS} ${Trilinos_LIBRARIES} ${Trilinos_TPL_LIBRARIES} ${CCSE_LIBRARIES} -lgfortran ${OTHER_CMAKE_EXE_LINKER_FLAGS} ${GTEST_BOTH_LIBRARIES} -lpthread)
......@@ -216,5 +216,3 @@ TEST(VariableRFCavityTest, TestApplyBoundingBox) {
EXPECT_FALSE(cav1.apply(R, centroid, t, E, B));
}
TEST(VariableRFCavityTest, DISABLED_TestAccept) {
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment