diff --git a/Changelog.md b/Changelog.md index 773ea3af9..073b11585 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,9 @@ ### SDFormat 7.0.0 (xxxx-xx-xx) +1. Build Utils_TEST with Utils.cc explicitly passed since its symbols are not visible. + * [Pull request 572](https://bitbucket.org/osrf/sdformat/pull-requests/572) + 1. Parse urdf files to sdf 1.5 instead of 1.4 to avoid `use_parent_model_frame`. * [Pull request 575](https://bitbucket.org/osrf/sdformat/pull-requests/575) diff --git a/cmake/SDFUtils.cmake b/cmake/SDFUtils.cmake index aa998aac0..8027512ce 100644 --- a/cmake/SDFUtils.cmake +++ b/cmake/SDFUtils.cmake @@ -125,6 +125,11 @@ macro (sdf_setup_apple) endmacro() ################################################# +# VAR: SDF_BUILD_TESTS_EXTRA_EXE_SRCS +# Hack: extra sources to build binaries can be supplied to gz_build_tests in +# the variable SDF_BUILD_TESTS_EXTRA_EXE_SRCS. This variable will be clean up +# at the end of the function +# include_directories(${PROJECT_SOURCE_DIR}/test/gtest/include) macro (sdf_build_tests) # Build all the tests @@ -133,10 +138,13 @@ macro (sdf_build_tests) set(BINARY_NAME ${TEST_TYPE}_${BINARY_NAME}) if (UNIX) - add_executable(${BINARY_NAME} ${GTEST_SOURCE_file}) + add_executable(${BINARY_NAME} + ${GTEST_SOURCE_file} + ${SDF_BUILD_TESTS_EXTRA_EXE_SRCS}) elseif(WIN32) add_executable(${BINARY_NAME} ${GTEST_SOURCE_file} + ${SDF_BUILD_TESTS_EXTRA_EXE_SRCS} ${PROJECT_SOURCE_DIR}/src/win/tinyxml/tinystr.cpp ${PROJECT_SOURCE_DIR}/src/win/tinyxml/tinyxmlerror.cpp ${PROJECT_SOURCE_DIR}/src/win/tinyxml/tinyxml.cpp @@ -214,6 +222,8 @@ macro (sdf_build_tests) --error-exitcode=1 --show-leak-kinds=all ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}) endif() endforeach() + + set(GZ_BUILD_TESTS_EXTRA_EXE_SRCS "") endmacro() ################################################# diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 54c724e6f..7641a8456 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -118,6 +118,11 @@ if (IGNITION-TOOLS_BINARY_DIRS) ) endif() +if (NOT WIN32) + set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS Utils.cc) + sdf_build_tests(Utils_TEST.cc) +endif() + sdf_build_tests(${gtest_sources}) sdf_add_library(${sdf_target} ${sources})