Skip to content

Commit

Permalink
[FIX] Fixing compilation of gtest 1.8.0 in Windows (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex952 authored Nov 9, 2018
1 parent 0d175e9 commit 61e04dc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
18 changes: 13 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,19 @@ set(CPACK_INSTALL_CMAKE_PROJECTS ${CPACK_INSTALL_CMAKE_PROJECTS} "${binary_dir};
# unit-tests
option(TESTS "Enable unit-tests" OFF)
if(TESTS)
ExternalProject_Add(
googletest
SOURCE_DIR ${PROJECT_SOURCE_DIR}/ext/googletest
CMAKE_ARGS -Dgtest_force_shared_crt=ON -DBUILD_GMOCK=ON -DBUILD_GTEST=ON -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/googletest -DCMAKE_INSTALL_LIBDIR=${CMAKE_BINARY_DIR}/googletest/lib
)
if(WIN32)
ExternalProject_Add(
googletest
SOURCE_DIR ${PROJECT_SOURCE_DIR}/ext/googletest
CMAKE_ARGS -Dgtest_force_shared_crt=ON -DCMAKE_CXX_FLAGS="/w" -DBUILD_GMOCK=ON -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/googletest -DCMAKE_INSTALL_LIBDIR=${CMAKE_BINARY_DIR}/googletest/lib
)
else()
ExternalProject_Add(
googletest
SOURCE_DIR ${PROJECT_SOURCE_DIR}/ext/googletest
CMAKE_ARGS -DBUILD_GMOCK=ON -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/googletest -DCMAKE_INSTALL_LIBDIR=${CMAKE_BINARY_DIR}/googletest/lib
)
endif()

include(CTest)
enable_testing()
Expand Down
2 changes: 1 addition & 1 deletion ext/googletest
Submodule googletest updated 338 files
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ target_link_libraries(unittest
gtest
gmock
)
add_dependencies(unittest googletest)

add_test(NAME unittest
COMMAND unittest --gtest_output=xml:../test.xml
Expand Down

0 comments on commit 61e04dc

Please sign in to comment.