diff --git a/CMakeLists.txt b/CMakeLists.txt index 7fd06b2..4f422e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,8 @@ SET ( CPPCORE_VERSION_PATCH 0 ) SET ( CPPCORE_VERSION ${CPPCORE_VERSION_MAJOR}.${CPPCORE_VERSION_MINOR}.${CPPCORE_VERSION_PATCH} ) SET ( PROJECT_VERSION "${CPPCORE_VERSION}" ) +find_package(GTest) + if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX ) find_package(Threads) endif() @@ -30,8 +32,6 @@ add_definitions( -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING=1) INCLUDE_DIRECTORIES( BEFORE include/ - contrib/googletest-1.15.2/googletest/include - contrib/googletest-1.15.2/googletest ) link_directories( @@ -157,8 +157,6 @@ IF( CPPCORE_BUILD_UNITTESTS ) test/Random/RandomGeneratorTest.cpp ) - SET ( GTEST_PATH ../contrib/googletest-1.15.2 ) - SOURCE_GROUP( code FILES ${cppcore_test_src} ) SOURCE_GROUP( code\\common FILES ${cppcore_common_test_src} ) SOURCE_GROUP( code\\container FILES ${cppcore_container_test_src} ) @@ -168,7 +166,18 @@ IF( CPPCORE_BUILD_UNITTESTS ) # Prevent overriding the parent project's compiler/linker # settings on Windows SET(gtest_force_shared_crt ON CACHE BOOL "" FORCE) - ADD_SUBDIRECTORY( contrib/googletest-1.15.2/ ) + if (GTest_FOUND) + SET(test_libs GTest::gtest_main) + else() + SET(test_libs gtest_main) + SET ( GTEST_PATH ../contrib/googletest-1.15.2 ) + INCLUDE_DIRECTORIES( + contrib/googletest-1.15.2/googletest/include + contrib/googletest-1.15.2/googletest + ) + ADD_SUBDIRECTORY( contrib/googletest-1.15.2/ ) + endif() + ADD_EXECUTABLE( cppcore_unittest ${cppcore_test_src} ${cppcore_common_test_src} @@ -182,5 +191,5 @@ IF( CPPCORE_BUILD_UNITTESTS ) ELSE( WIN32 ) SET( platform_libs pthread ) ENDIF( WIN32 ) - target_link_libraries( cppcore_unittest cppcore ${CMAKE_THREAD_LIBS_INIT} gtest_main ${platform_libs} ) + target_link_libraries( cppcore_unittest cppcore ${CMAKE_THREAD_LIBS_INIT} ${platform_libs} ${test_libs}) ENDIF() diff --git a/contrib/googletest-1.15.2/googletest/generated/GTestConfig.cmake b/contrib/googletest-1.15.2/googletest/generated/GTestConfig.cmake index 9ab9a5e..2ac43eb 100644 --- a/contrib/googletest-1.15.2/googletest/generated/GTestConfig.cmake +++ b/contrib/googletest-1.15.2/googletest/generated/GTestConfig.cmake @@ -24,7 +24,7 @@ endmacro() #################################################################################### include(CMakeFindDependencyMacro) -if (ON) +if () set(THREADS_PREFER_PTHREAD_FLAG ) find_dependency(Threads) endif() diff --git a/contrib/googletest-1.15.2/googletest/generated/gmock.pc b/contrib/googletest-1.15.2/googletest/generated/gmock.pc index 2a94252..cf23988 100644 --- a/contrib/googletest-1.15.2/googletest/generated/gmock.pc +++ b/contrib/googletest-1.15.2/googletest/generated/gmock.pc @@ -1,5 +1,5 @@ -libdir=/usr/local/lib -includedir=/usr/local/include +libdir=C:/Program Files (x86)/osre/lib +includedir=C:/Program Files (x86)/osre/include Name: gmock Description: GoogleMock (without main() function) @@ -7,4 +7,4 @@ Version: 1.15.2 URL: https://github.com/google/googletest Requires: gtest = 1.15.2 Libs: -L${libdir} -lgmock -Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 +Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=0 diff --git a/contrib/googletest-1.15.2/googletest/generated/gmock_main.pc b/contrib/googletest-1.15.2/googletest/generated/gmock_main.pc index 6953642..3dadafc 100644 --- a/contrib/googletest-1.15.2/googletest/generated/gmock_main.pc +++ b/contrib/googletest-1.15.2/googletest/generated/gmock_main.pc @@ -1,5 +1,5 @@ -libdir=/usr/local/lib -includedir=/usr/local/include +libdir=C:/Program Files (x86)/osre/lib +includedir=C:/Program Files (x86)/osre/include Name: gmock_main Description: GoogleMock (with main() function) @@ -7,4 +7,4 @@ Version: 1.15.2 URL: https://github.com/google/googletest Requires: gmock = 1.15.2 Libs: -L${libdir} -lgmock_main -Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 +Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=0 diff --git a/contrib/googletest-1.15.2/googletest/generated/gtest.pc b/contrib/googletest-1.15.2/googletest/generated/gtest.pc index 7d36793..d512a14 100644 --- a/contrib/googletest-1.15.2/googletest/generated/gtest.pc +++ b/contrib/googletest-1.15.2/googletest/generated/gtest.pc @@ -1,9 +1,9 @@ -libdir=/usr/local/lib -includedir=/usr/local/include +libdir=C:/Program Files (x86)/osre/lib +includedir=C:/Program Files (x86)/osre/include Name: gtest Description: GoogleTest (without main() function) Version: 1.15.2 URL: https://github.com/google/googletest Libs: -L${libdir} -lgtest -Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 +Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=0 diff --git a/contrib/googletest-1.15.2/googletest/generated/gtest_main.pc b/contrib/googletest-1.15.2/googletest/generated/gtest_main.pc index 0b35915..0d18961 100644 --- a/contrib/googletest-1.15.2/googletest/generated/gtest_main.pc +++ b/contrib/googletest-1.15.2/googletest/generated/gtest_main.pc @@ -1,5 +1,5 @@ -libdir=/usr/local/lib -includedir=/usr/local/include +libdir=C:/Program Files (x86)/osre/lib +includedir=C:/Program Files (x86)/osre/include Name: gtest_main Description: GoogleTest (with main() function) @@ -7,4 +7,4 @@ Version: 1.15.2 URL: https://github.com/google/googletest Requires: gtest = 1.15.2 Libs: -L${libdir} -lgtest_main -Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 +Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=0 diff --git a/contrib/googletest-1.15.2/googletest/gtest.dir/Debug/gtest.lib.recipe b/contrib/googletest-1.15.2/googletest/gtest.dir/Debug/gtest.lib.recipe index c4a5ed7..d203f96 100644 --- a/contrib/googletest-1.15.2/googletest/gtest.dir/Debug/gtest.lib.recipe +++ b/contrib/googletest-1.15.2/googletest/gtest.dir/Debug/gtest.lib.recipe @@ -2,7 +2,7 @@ - C:\develop\projects\cppcore\x64\Debug\ZERO_CHECK + C:\develop\projects\osre\x64\Debug\ZERO_CHECK diff --git a/contrib/googletest-1.15.2/googletest/gtest_main.dir/Debug/gtest_main.lib.recipe b/contrib/googletest-1.15.2/googletest/gtest_main.dir/Debug/gtest_main.lib.recipe index c4a5ed7..d203f96 100644 --- a/contrib/googletest-1.15.2/googletest/gtest_main.dir/Debug/gtest_main.lib.recipe +++ b/contrib/googletest-1.15.2/googletest/gtest_main.dir/Debug/gtest_main.lib.recipe @@ -2,7 +2,7 @@ - C:\develop\projects\cppcore\x64\Debug\ZERO_CHECK + C:\develop\projects\osre\x64\Debug\ZERO_CHECK