Skip to content

Commit

Permalink
Merge pull request #526 from chuckatkins/fix-windows-warnings
Browse files Browse the repository at this point in the history
Fix gtest windows warnings
  • Loading branch information
Chuck Atkins authored Apr 4, 2018
2 parents d33a9d1 + 1544ef9 commit 96500f8
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 29 deletions.
3 changes: 3 additions & 0 deletions CTestCustom.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# accompanying file Copyright.txt for details.
#------------------------------------------------------------------------------#

set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 1000)
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 1000)

list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
"H5PL\\.c.*dlopen.*glibc"
"gtest\\.cc.*getaddrinfo.*glibc"
Expand Down
4 changes: 2 additions & 2 deletions testing/adios2/engine/adios1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
#------------------------------------------------------------------------------#

add_executable(TestADIOS1WriteRead TestADIOS1WriteRead.cpp)
target_link_libraries(TestADIOS1WriteRead adios2 gtest adios1::adios)
target_link_libraries(TestADIOS1WriteRead adios2 gtest_interface adios1::adios)

if(ADIOS2_HAVE_MPI)

add_executable(TestADIOS1WriteADIOS2Read TestADIOS1WriteADIOS2Read.cpp)
target_link_libraries(TestADIOS1WriteADIOS2Read adios2 gtest adios1::adios)
target_link_libraries(TestADIOS1WriteADIOS2Read adios2 gtest_interface adios1::adios)

target_link_libraries(TestADIOS1WriteRead MPI::MPI_C)
target_link_libraries(TestADIOS1WriteADIOS2Read MPI::MPI_C)
Expand Down
24 changes: 12 additions & 12 deletions testing/adios2/engine/bp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
#------------------------------------------------------------------------------#

add_executable(TestBPWriteReadADIOS2 TestBPWriteReadADIOS2.cpp)
target_link_libraries(TestBPWriteReadADIOS2 adios2 gtest gtest_main)
target_link_libraries(TestBPWriteReadADIOS2 adios2 gtest)

add_executable(TestBPWriteReadAsStreamADIOS2 TestBPWriteReadAsStreamADIOS2.cpp)
target_link_libraries(TestBPWriteReadAsStreamADIOS2 adios2 gtest gtest_main)
target_link_libraries(TestBPWriteReadAsStreamADIOS2 adios2 gtest)

add_executable(TestBPWriteReadAsStreamADIOS2_Threads TestBPWriteReadAsStreamADIOS2_Threads.cpp)
target_link_libraries(TestBPWriteReadAsStreamADIOS2_Threads adios2 gtest gtest_main)
target_link_libraries(TestBPWriteReadAsStreamADIOS2_Threads adios2 gtest)

add_executable(TestBPWriteReadAttributesADIOS2 TestBPWriteReadAttributesADIOS2.cpp)
target_link_libraries(TestBPWriteReadAttributesADIOS2 adios2 gtest gtest_main)
target_link_libraries(TestBPWriteReadAttributesADIOS2 adios2 gtest)

add_executable(TestStreamWriteReadHighLevelAPI TestStreamWriteReadHighLevelAPI.cpp)
target_link_libraries(TestStreamWriteReadHighLevelAPI adios2 gtest gtest_main)
target_link_libraries(TestStreamWriteReadHighLevelAPI adios2 gtest)

add_executable(TestBPWriteFlushRead TestBPWriteFlushRead.cpp)
target_link_libraries(TestBPWriteFlushRead adios2 gtest gtest_main)
target_link_libraries(TestBPWriteFlushRead adios2 gtest)

if(ADIOS2_HAVE_MPI)

Expand All @@ -31,7 +31,7 @@ if(ADIOS2_HAVE_MPI)
target_link_libraries(TestBPWriteFlushRead MPI::MPI_C)

add_executable(TestBPWriteAggregateRead TestBPWriteAggregateRead.cpp)
target_link_libraries(TestBPWriteAggregateRead adios2 gtest gtest_main MPI::MPI_C)
target_link_libraries(TestBPWriteAggregateRead adios2 gtest_interface MPI::MPI_C)

set(extra_test_args EXEC_WRAPPER ${MPIEXEC_COMMAND})
gtest_add_tests(TARGET TestBPWriteAggregateRead ${extra_test_args})
Expand All @@ -47,19 +47,19 @@ gtest_add_tests(TARGET TestBPWriteFlushRead ${extra_test_args})

if (ADIOS2_HAVE_ADIOS1)
add_executable(TestBPWriteRead TestBPWriteRead.cpp)
target_link_libraries(TestBPWriteRead adios2 gtest adios1::adios)
target_link_libraries(TestBPWriteRead adios2 gtest_interface adios1::adios)

add_executable(TestBPWriteReadAttributes TestBPWriteReadAttributes.cpp)
target_link_libraries(TestBPWriteReadAttributes adios2 gtest adios1::adios)
target_link_libraries(TestBPWriteReadAttributes adios2 gtest_interface adios1::adios)

add_executable(TestBPWriteReadstdio TestBPWriteReadstdio.cpp)
target_link_libraries(TestBPWriteReadstdio adios2 gtest adios1::adios)
target_link_libraries(TestBPWriteReadstdio adios2 gtest_interface adios1::adios)

add_executable(TestBPWriteReadfstream TestBPWriteReadfstream.cpp)
target_link_libraries(TestBPWriteReadfstream adios2 gtest adios1::adios)
target_link_libraries(TestBPWriteReadfstream adios2 gtest_interface adios1::adios)

add_executable(TestBPWriteProfilingJSON TestBPWriteProfilingJSON.cpp)
target_link_libraries(TestBPWriteProfilingJSON adios2 gtest NLohmannJson)
target_link_libraries(TestBPWriteProfilingJSON adios2 gtest_interface NLohmannJson)

if(ADIOS2_HAVE_MPI)
target_link_libraries(TestBPWriteRead MPI::MPI_C)
Expand Down
2 changes: 1 addition & 1 deletion testing/adios2/engine/hdf5/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if(HDF5_C_INCLUDE_DIRS)
else()
target_include_directories(TestHDF5WriteRead PRIVATE ${HDF5_INCLUDE_DIRS})
endif()
target_link_libraries(TestHDF5WriteRead adios2 gtest ${HDF5_C_LIBRARIES})
target_link_libraries(TestHDF5WriteRead adios2 gtest_interface ${HDF5_C_LIBRARIES})

if(ADIOS2_HAVE_MPI)
target_link_libraries(TestHDF5WriteRead MPI::MPI_C)
Expand Down
2 changes: 1 addition & 1 deletion testing/adios2/engine/insitumpi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
set(extra_test_args EXEC_WRAPPER ${MPIEXEC_COMMAND})

add_executable(TestInSituMPIFunctionAssignPeers TestInSituMPIFunctionAssignPeers.cpp)
target_link_libraries(TestInSituMPIFunctionAssignPeers adios2 gtest MPI::MPI_C)
target_link_libraries(TestInSituMPIFunctionAssignPeers adios2 gtest_interface MPI::MPI_C)
gtest_add_tests(TARGET TestInSituMPIFunctionAssignPeers ${extra_test_args})


Expand Down
4 changes: 2 additions & 2 deletions testing/adios2/engine/sst/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ if(SST_INCLUDE_DIRS)
target_include_directories(TestSstWrite PRIVATE ${SST_INCLUDE_DIRS})
target_include_directories(TestSstRead PRIVATE ${SST_INCLUDE_DIRS})
endif()
target_link_libraries(TestSstWrite adios2 gtest ${Sst_LIBRARY})
target_link_libraries(TestSstRead adios2 gtest ${Sst_LIBRARY})
target_link_libraries(TestSstWrite adios2 gtest_interface ${Sst_LIBRARY})
target_link_libraries(TestSstRead adios2 gtest_interface ${Sst_LIBRARY})

if(ADIOS2_HAVE_MPI)
target_link_libraries(TestSstWrite MPI::MPI_C)
Expand Down
2 changes: 1 addition & 1 deletion testing/adios2/engine/staging-common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set(extra_test_args EXEC_WRAPPER ${MPIEXEC_COMMAND})
add_executable(TestStagingMPMD TestStagingMPMD.cpp)
target_link_libraries(TestStagingMPMD adios2 gtest)
if(ADIOS2_HAVE_MPI)
target_link_libraries(TestStagingMPMD adios2 gtest MPI::MPI_C)
target_link_libraries(TestStagingMPMD adios2 gtest_interface MPI::MPI_C)
endif()

if(ADIOS2_HAVE_SST)
Expand Down
6 changes: 3 additions & 3 deletions testing/adios2/interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
#------------------------------------------------------------------------------#

add_executable(TestADIOSInterfaceWrite TestADIOSInterfaceWrite.cpp)
target_link_libraries(TestADIOSInterfaceWrite adios2 gtest gtest_main)
target_link_libraries(TestADIOSInterfaceWrite adios2 gtest)

add_executable(TestADIOSDefineVariable TestADIOSDefineVariable.cpp)
target_link_libraries(TestADIOSDefineVariable adios2 gtest gtest_main)
target_link_libraries(TestADIOSDefineVariable adios2 gtest)

add_executable(TestADIOSDefineAttribute TestADIOSDefineAttribute.cpp)
target_link_libraries(TestADIOSDefineAttribute adios2 gtest gtest_main)
target_link_libraries(TestADIOSDefineAttribute adios2 gtest)

if(ADIOS2_HAVE_MPI)
target_link_libraries(TestADIOSInterfaceWrite MPI::MPI_C)
Expand Down
2 changes: 1 addition & 1 deletion testing/adios2/performance/manyvars/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#------------------------------------------------------------------------------#

add_executable(TestManyVars manyVars.cpp)
target_link_libraries(TestManyVars adios2 gtest gtest_main)
target_link_libraries(TestManyVars adios2 gtest)
if(ADIOS2_HAVE_MPI)
target_link_libraries(TestManyVars MPI::MPI_C)
endif()
Expand Down
4 changes: 2 additions & 2 deletions testing/adios2/transform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

if(ADIOS2_HAVE_BZip2)
add_executable(TestBZip2Wrapper TestBZip2Wrapper.cpp)
target_link_libraries(TestBZip2Wrapper adios2 gtest gtest_main)
target_link_libraries(TestBZip2Wrapper adios2 gtest)

gtest_add_tests(TARGET TestBZip2Wrapper)
endif()

if(ADIOS2_HAVE_ZFP)
add_executable(TestZfpWrapper TestZfpWrapper.cpp)
target_link_libraries(TestZfpWrapper adios2 gtest gtest_main)
target_link_libraries(TestZfpWrapper adios2 gtest)

gtest_add_tests(TARGET TestZfpWrapper)
endif()
2 changes: 1 addition & 1 deletion testing/adios2/xml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#------------------------------------------------------------------------------#

add_executable(TestXMLConfig TestXMLConfig.cpp)
target_link_libraries(TestXMLConfig adios2 gtest gtest_main)
target_link_libraries(TestXMLConfig adios2 gtest)
target_compile_definitions(TestXMLConfig PRIVATE
"XML_CONFIG_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
)
Expand Down
14 changes: 11 additions & 3 deletions thirdparty/GTest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
set(BUILD_GTEST ON CACHE INTERNAL "")
set(BUILD_GMOCK OFF CACHE INTERNAL "")
set(gtest_disable_pthreads ON)
if(BUILD_SHARED_LIBS)
set(gtest_force_shared_crt ON CACHE INTERNAL "")
endif()
set(BUILD_SHARED_LIBS OFF)

set(CMAKE_POLICY_DEFAULT_CMP0042 NEW)

add_subdirectory(googletest EXCLUDE_FROM_ALL)

if(WIN32 AND BUILD_SHARED_LIBS)
target_compile_definitions(gtest_main INTERFACE GTEST_LINKED_AS_SHARED_LIBRARY=1)
add_library(gtest_interface INTERFACE)
target_link_libraries(gtest_interface INTERFACE gtest)
if(BUILD_SHARED_LIBS)
target_compile_definitions(gtest_interface INTERFACE
GTEST_LINKED_AS_SHARED_LIBRARY=1
)
endif()

0 comments on commit 96500f8

Please sign in to comment.