-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from chuckatkins/add-googletest
Add initial third party library support with the google test framework
- Loading branch information
Showing
3 changed files
with
80 additions
and
15 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
set(ADIOS_THIRDPARTY_DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/downloads | ||
CACHE PATH "Download directory for third party dependencies") | ||
|
||
include(ExternalProject) | ||
|
||
# Boilerplate settings for a common external project infrastructure | ||
set(EP_ARGS | ||
DOWNLOAD_DIR ${ADIOS_THIRDPARTY_DOWNLOAD_DIR} | ||
PREFIX . | ||
SOURCE_DIR source | ||
BINARY_DIR build | ||
STAMP_DIR stamp | ||
INSTALL_DIR install) | ||
|
||
# Use Google Test for a unit testing framework | ||
cmake_dependent_option(ADIOS_USE_SYSTEM_GOOGLETEST | ||
"Use a system-supplied Google Test framework" OFF | ||
"BUILD_TESTING" OFF) | ||
if(BUILD_TESTING) | ||
if(NOT ADIOS_USE_SYSTEM_GOOGLETEST) | ||
add_subdirectory(googletest) | ||
endif() | ||
find_package(GTest REQUIRED) | ||
if(NOT ADIOS_USE_SYSTEM_GOOGLETEST) | ||
add_dependencies(GTest::GTest googletest) | ||
add_dependencies(GTest::Main googletest) | ||
endif() | ||
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
ExternalProject_Add(googletest | ||
URL https://github.com/google/googletest/archive/release-1.8.0.zip | ||
URL_MD5 adfafc8512ab65fd3cf7955ef0100ff5 | ||
${EP_ARGS} | ||
CMAKE_ARGS | ||
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/install | ||
-DCMAKE_POLICY_DEFAULT_CMP0048=OLD | ||
-DCMAKE_POLICY_DEFAULT_CMP0063=NEW | ||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} | ||
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} | ||
-DBUILD_GMOCK=OFF | ||
-DBUILD_GTEST=ON | ||
-Dgtest_build_samples=OFF | ||
-Dgtest_build_tests=OFF | ||
-Dgtest_hide_internal_symbols=ON | ||
-Dgtest_disable_pthreads=OFF | ||
-Dgtest_force_shared_crt=OFF) | ||
|
||
function(get_libfile var name) | ||
if(BUILD_SHARED_LIBS) | ||
set(${var} ${CMAKE_SHARED_LIBRARY_PREFIX}${name}${CMAKE_SHARED_LIBRARY_SUFFIX} PARENT_SCOPE) | ||
else() | ||
set(${var} ${CMAKE_STATIC_LIBRARY_PREFIX}${name}${CMAKE_STATIC_LIBRARY_SUFFIX} PARENT_SCOPE) | ||
endif() | ||
endfunction() | ||
|
||
get_libfile(GTEST_LIBRARY gtest) | ||
get_libfile(GTEST_MAIN_LIBRARY gtest_main) | ||
set(GTEST_ROOT ${CMAKE_CURRENT_BINARY_DIR}/install) | ||
set(GTEST_INCLUDE_DIR ${GTEST_ROOT}/include | ||
CACHE PATH "") | ||
set(GTEST_LIBRARY ${GTEST_ROOT}/lib/${GTEST_LIBRARY} | ||
CACHE FILEPATH "") | ||
set(GTEST_MAIN_LIBRARY ${GTEST_ROOT}/lib/${GTEST_MAIN_LIBRARY} | ||
CACHE FILEPATH "") |