sdformat/sdformat-1.4.10-gtest.patch

58 lines
2.0 KiB
Diff
Raw Normal View History

2013-11-22 03:48:49 +00:00
diff -up ./cmake/SDFUtils.cmake.gtest ./cmake/SDFUtils.cmake
--- ./cmake/SDFUtils.cmake.gtest 2013-11-18 20:50:30.975458969 -0500
+++ ./cmake/SDFUtils.cmake 2013-11-18 21:00:52.068647047 -0500
@@ -102,17 +102,21 @@ macro (sdf_build_tests)
add_executable(${BINARY_NAME} ${GTEST_SOURCE_file})
add_dependencies(${BINARY_NAME}
- gtest gtest_main sdformat
- ${tinyxml_libraries}
+ sdformat ${tinyxml_libraries}
)
-
+ if(NOT GTEST_FOUND)
+ add_dependencies(${BINARY_NAME} gtest gtest_main)
+ endif()
+
target_link_libraries(${BINARY_NAME}
- libgtest.a
- libgtest_main.a
+ ${GTEST_LIBRARY}
+ ${GTEST_MAIN_LIBRARY}
sdformat
pthread
${tinyxml_libraries}
)
+
+ include_directories(${GTEST_INCLUDE_DIR})
add_test(${BINARY_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}
--gtest_output=xml:${CMAKE_BINARY_DIR}/test_results/${BINARY_NAME}.xml)
diff -up ./test/CMakeLists.txt.gtest ./test/CMakeLists.txt
--- ./test/CMakeLists.txt.gtest 2013-11-18 20:55:13.775499141 -0500
+++ ./test/CMakeLists.txt 2013-11-18 21:01:03.068073795 -0500
@@ -2,9 +2,6 @@ include_directories (
${PROJECT_SOURCE_DIR}/include
${PROJECT_BINARY_DIR}/include
${Boost_INCLUDE_DIRS}
- ${PROJECT_SOURCE_DIR}/test/gtest/include
- ${PROJECT_SOURCE_DIR}/test/gtest
- ${PROJECT_SOURCE_DIR}/test
)
link_directories(
@@ -13,13 +10,6 @@ link_directories(
configure_file (test_config.h.in ${PROJECT_BINARY_DIR}/test_config.h)
-# Build gtest
-add_library(gtest STATIC gtest/src/gtest-all.cc)
-add_library(gtest_main STATIC gtest/src/gtest_main.cc)
-target_link_libraries(gtest_main gtest)
-set(GTEST_LIBRARY "${PROJECT_BINARY_DIR}/test/libgtest.a")
-set(GTEST_MAIN_LIBRARY "${PROJECT_BINARY_DIR}/test/libgtest_main.a")
-
execute_process(COMMAND cmake -E remove_directory ${CMAKE_BINARY_DIR}/test_results)
execute_process(COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/test_results)
include_directories(${GTEST_INCLUDE_DIRS})