-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
54 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
if(ENABLE_UNIT_TESTS) | ||
include(CTest) | ||
enable_testing() | ||
find_package(Threads REQUIRED) | ||
|
||
add_subdirectory(test) | ||
enable_testing() | ||
add_subdirectory(test) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
foreach(dir lebedev | ||
gtest | ||
) | ||
add_subdirectory(${dir}) | ||
endforeach() | ||
add_subdirectory(lebedev) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,64 @@ | ||
set(gtest_ROOT ${PROJECT_BINARY_DIR}/external/upstream/gtest) | ||
set(gtest_SOURCE_DIR ${gtest_ROOT}/src/gtest/googletest) | ||
set(gtest_BINARY_DIR ${gtest_ROOT}/src/gtest-build/googlemock/gtest) | ||
# copy reference file to ${PROJECT_BINARY_DIR}/test (aka ${CMAKE_CURRENT_BINARY_DIR}) | ||
file(COPY reference_grid.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) | ||
|
||
include_directories(${gtest_SOURCE_DIR}/include) | ||
link_directories(${gtest_BINARY_DIR}) | ||
include(ExternalProject) | ||
|
||
# Copy reference file to ${PROJECT_BINARY_DIR}/test (aka ${CMAKE_CURRENT_BINARY_DIR}) | ||
file(COPY reference_grid.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) | ||
ExternalProject_Add( | ||
gtest | ||
PREFIX | ||
"${PROJECT_BINARY_DIR}/gtest" | ||
GIT_REPOSITORY | ||
https://github.com/google/googletest.git | ||
GIT_TAG | ||
release-1.8.0 | ||
CMAKE_ARGS | ||
"-Dgtest_disable_pthreads=ON" | ||
INSTALL_COMMAND | ||
"" # prevent gtest from installing itself system-wide | ||
BUILD_BYPRODUCTS | ||
# this is here otherwise Ninja will complain | ||
# that there is no rule to build libgtest.a | ||
${PROJECT_BINARY_DIR}/gtest/src/gtest-build/googlemock/gtest/libgtest.a | ||
) | ||
|
||
add_executable( | ||
cpp_test | ||
main.cpp | ||
test.cpp | ||
) | ||
|
||
target_include_directories(cpp_test PRIVATE ${PROJECT_SOURCE_DIR}/numgrid ${PROJECT_BINARY_DIR}/include) | ||
cpp_test | ||
main.cpp | ||
test.cpp | ||
) | ||
|
||
add_dependencies(cpp_test gtest) | ||
target_include_directories( | ||
cpp_test | ||
PRIVATE | ||
${PROJECT_SOURCE_DIR}/numgrid | ||
${PROJECT_BINARY_DIR}/include | ||
${PROJECT_BINARY_DIR}/gtest/src/gtest/googletest/include | ||
) | ||
|
||
target_link_libraries( | ||
cpp_test | ||
numgrid | ||
libgtest.a | ||
Threads::Threads | ||
) | ||
cpp_test | ||
PRIVATE | ||
numgrid | ||
${PROJECT_BINARY_DIR}/gtest/src/gtest-build/googlemock/gtest/libgtest.a | ||
) | ||
|
||
# make sure that gtest is built before we build cpp_test | ||
add_dependencies(cpp_test gtest) | ||
|
||
add_test(cpp_test ${PROJECT_BINARY_DIR}/bin/cpp_test) | ||
|
||
if(ENABLE_FC_SUPPORT) | ||
add_executable( | ||
fortran_test | ||
test.f90 | ||
) | ||
add_executable( | ||
fortran_test | ||
test.f90 | ||
) | ||
|
||
add_dependencies(fortran_test gtest) | ||
add_dependencies(fortran_test gtest) | ||
|
||
target_link_libraries( | ||
fortran_test | ||
numgrid | ||
) | ||
target_link_libraries( | ||
fortran_test | ||
numgrid | ||
) | ||
|
||
add_test(fortran_test ${PROJECT_BINARY_DIR}/bin/fortran_test) | ||
add_test(fortran_test ${PROJECT_BINARY_DIR}/bin/fortran_test) | ||
endif() |