Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/bugfix/8408_fix_msvc_linker_warn…
Browse files Browse the repository at this point in the history
…ings'
  • Loading branch information
Michael Reuter committed Nov 18, 2013
2 parents 555234d + 178a42e commit 0696ddc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
14 changes: 11 additions & 3 deletions Code/Mantid/TestingTools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#add_subdirectory( gtest-1.6.0 )
if( MSVC )
# We are building static libraries but we want them to dynamically link
# the to C/C++ runtime or we get duplicate library warnings
set ( gtest_force_shared_crt ON )
endif()
add_subdirectory( gmock-1.6.0 )

set_target_properties( gmock PROPERTIES EXCLUDE_FROM_ALL TRUE )
set_target_properties( gtest PROPERTIES EXCLUDE_FROM_ALL TRUE )
# Put the targets in the UnitTests folder
foreach( target_var
gmock gtest )
set_target_properties( ${target_var} PROPERTIES EXCLUDE_FROM_ALL TRUE
FOLDER "UnitTests/gmock" )
endforeach()
7 changes: 4 additions & 3 deletions Code/Mantid/TestingTools/gmock-1.6.0/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ include_directories("${gmock_SOURCE_DIR}/include"
# are used for other targets, to ensure that Google Mock can be compiled by
# a user aggressive about warnings.

if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set ( cxx_strict "/MD ${cxx_strict}")
endif()
## MANTID: Not required, this is done by cmake & has been removed in gmock-1.7.0 ##
# if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
# set ( cxx_strict "/MD ${cxx_strict}")
#endif()

cxx_library(gmock "${cxx_strict}" src/gmock-all.cc)
target_link_libraries(gmock gtest)
Expand Down
14 changes: 10 additions & 4 deletions Code/Mantid/TestingTools/gmock-1.6.0/gtest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)

# When other libraries are using a shared version of runtime libraries,
# Google Test also has to use one.
if(gtest_force_shared_crt) # May have been defined by gmock & they need to be the same
set( _default_force_crt ${gtest_force_shared_crt} )
else()
set( _default_force_crt OFF )
endif()
option(
gtest_force_shared_crt
"Use shared (DLL) run-time lib even when Google Test is built as static lib."
OFF)
${_default_force_crt})

option(gtest_build_tests "Build all of gtest's own tests." OFF)

Expand Down Expand Up @@ -67,9 +72,10 @@ link_directories(${gtest_BINARY_DIR}/src)
# Google Test libraries. We build them using more strict warnings than what
# are used for other targets, to ensure that gtest can be compiled by a user
# aggressive about warnings.
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set ( cxx_strict "/MD ${cxx_strict}")
endif()
## MANTID: Not required, this is done by cmake & has been removed in gmock-1.7.0 ##
#if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
# set ( cxx_strict "/MD ${cxx_strict}")
#endif()
cxx_library(gtest "${cxx_strict}" src/gtest-all.cc)
#cxx_library(gtest_main "${cxx_strict}" src/gtest_main.cc)
#target_link_libraries(gtest_main gtest)
Expand Down

0 comments on commit 0696ddc

Please sign in to comment.