Skip to content
Snippets Groups Projects
Commit 03af3d68 authored by Atkins, Charles Vernon's avatar Atkins, Charles Vernon Committed by GitHub
Browse files

Merge pull request #4 from chuckatkins/add-googletest

Add initial third party library support with the google test framework
parents 6b154e5c 1d2848f4
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,7 @@
#------------------------------------------------------------------------------#
cmake_minimum_required(VERSION 3.7)
project(ADIOS VERSION 2.0.a)
project(ADIOS VERSION 2.0.0)
#------------------------------------------------------------------------------#
# Some boilerplate to setup nice output directories
......@@ -50,11 +50,24 @@ if(ADIOS_ENABLE_PIC)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
#------------------------------------------------------------------------------#
# Third party libraries
#------------------------------------------------------------------------------#
include(CTest)
add_subdirectory(thirdparty)
#------------------------------------------------------------------------------#
# Main library source
#------------------------------------------------------------------------------#
add_subdirectory(source)
#------------------------------------------------------------------------------#
# Installation
#------------------------------------------------------------------------------#
install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h"
)
#------------------------------------------------------------------------------#
# Examples
#------------------------------------------------------------------------------#
......@@ -66,20 +79,8 @@ endif()
#------------------------------------------------------------------------------#
# Testing
#------------------------------------------------------------------------------#
include(CTest)
option(ADIOS_ENABLE_TESTING "Enable ADIOS Testing" ON)
set(ENABLE_TESTING ${ADIOS_ENABLE_TESTING} CACHE INTERNAL "" FORCE)
mark_as_advanced(ENABLE_TESTING)
if(ADIOS_ENABLE_TESTING)
# We have to wait until after the library is defined to enable testing
if(BUILD_TESTING)
enable_testing()
add_subdirectory(testing)
endif()
#------------------------------------------------------------------------------#
# Installation
#------------------------------------------------------------------------------#
install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h"
)
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()
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 "")
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