Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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(
Expand Down Expand Up @@ -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} )
Expand All @@ -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}
Expand All @@ -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()
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ endmacro()

####################################################################################
include(CMakeFindDependencyMacro)
if (ON)
if ()
set(THREADS_PREFER_PTHREAD_FLAG )
find_dependency(Threads)
endif()
Expand Down
6 changes: 3 additions & 3 deletions contrib/googletest-1.15.2/googletest/generated/gmock.pc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
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)
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
6 changes: 3 additions & 3 deletions contrib/googletest-1.15.2/googletest/generated/gmock_main.pc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
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)
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
6 changes: 3 additions & 3 deletions contrib/googletest-1.15.2/googletest/generated/gtest.pc
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions contrib/googletest-1.15.2/googletest/generated/gtest_main.pc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
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)
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>C:\develop\projects\cppcore\x64\Debug\ZERO_CHECK</FullPath>
<FullPath>C:\develop\projects\osre\x64\Debug\ZERO_CHECK</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>C:\develop\projects\cppcore\x64\Debug\ZERO_CHECK</FullPath>
<FullPath>C:\develop\projects\osre\x64\Debug\ZERO_CHECK</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />
Expand Down