Skip to content

Commit

Permalink
CMake updates for new googletest version
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <michael@openrobotics.org>
  • Loading branch information
mjcarroll committed Jun 28, 2022
1 parent ae3c075 commit 621dfb2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 23 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ find_package(gz-cmake3 REQUIRED)
#============================================================================
# Configure the project
#============================================================================
set (c++standard 17)
set (CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

gz_configure_project(
REPLACE_IGNITION_INCLUDE_PATH gz/math
VERSION_SUFFIX pre1)
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
gz_get_libsources_and_unittests(sources gtest_sources)

# Create the library target
gz_create_core_library(SOURCES ${sources} CXX_STANDARD ${c++standard})
gz_create_core_library(SOURCES ${sources})

target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
Expand Down
1 change: 0 additions & 1 deletion src/ruby/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ if (RUBY_FOUND)
gz-utils${GZ_UTILS_VER}::gz-utils${GZ_UTILS_VER}
gz-math${PROJECT_VERSION_MAJOR}
)
target_compile_features(${SWIG_RB_LIB} PUBLIC ${IGN_CXX_${c++standard}_FEATURES})

set_target_properties(${SWIG_RB_LIB}
PROPERTIES
Expand Down
24 changes: 5 additions & 19 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
configure_file (test_config.hh.in
${PROJECT_BINARY_DIR}/include/test_config.hh
)
include_directories (
${PROJECT_SOURCE_DIR}/test/gtest/include
${PROJECT_SOURCE_DIR}/test/gtest
${PROJECT_SOURCE_DIR}/test
${CMAKE_BINARY_DIR}/include
${PROJECT_BINARY_DIR}/include
)

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_property(TARGET gtest_main PROPERTY CXX_STANDARD ${c++standard})
set_property(TARGET gtest PROPERTY CXX_STANDARD ${c++standard})
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})

#============================================================================
# Do a fake install of ign-math in order to test the examples.
#============================================================================
Expand All @@ -41,6 +26,7 @@ ExternalProject_Add(
"-DCMAKE_INSTALL_PREFIX=${FAKE_INSTALL_PREFIX}"
)

add_subdirectory(gtest_vendor)
add_subdirectory(integration)
add_subdirectory(performance)
add_subdirectory(regression)

0 comments on commit 621dfb2

Please sign in to comment.