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 6ac6c0e commit dde439e
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 26 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ set(GZ_CMAKE_VER ${gz-cmake3_VERSION_MAJOR})
#============================================================================
# Configure the project
#============================================================================
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

gz_configure_project(
REPLACE_IGNITION_INCLUDE_PATH gz/common
VERSION_SUFFIX pre1)

#============================================================================
# Set project-specific options
#============================================================================
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

#--------------------------------------
# Option: Should Windows test symlinking?
if(WIN32)
Expand Down
3 changes: 1 addition & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ gz_get_libsources_and_unittests(sources gtest_sources)

# Create the library target
gz_create_core_library(
SOURCES ${sources}
CXX_STANDARD 17)
SOURCES ${sources})

if (CMAKE_CXX_COMPILER_ID STREQUAL GNU)
set(CXX_FILESYSTEM_LIBRARIES stdc++fs)
Expand Down
14 changes: 1 addition & 13 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
include_directories(
${PROJECT_SOURCE_DIR}/test/gtest/include
${PROJECT_SOURCE_DIR}/test/gtest
${PROJECT_SOURCE_DIR}/test
)

# 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")
add_subdirectory(gtest_vendor)

add_subdirectory(integration)
add_subdirectory(performance)
Expand Down
1 change: 1 addition & 0 deletions test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ if(TARGET INTEGRATION_plugin)
# before INTEGRATION_plugin so that its auto-generated header is available.
# We do not want to link INTEGRATION_plugin to the DummyPlugins library.
add_dependencies(INTEGRATION_plugin GzDummyPlugins)
target_include_directories(INTEGRATION_plugin PRIVATE ${PROJECT_SOURCE_DIR}/test)
endif()

if(TARGET INTEGRATION_mesh)
Expand Down
3 changes: 1 addition & 2 deletions test/performance/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ if("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "COVERAGE")
plugin_specialization.cc)
endif()

link_directories(${PROJECT_BINARY_DIR}/test)

gz_build_tests(
TYPE PERFORMANCE
SOURCES ${tests})
Expand All @@ -17,4 +15,5 @@ if(TARGET PERFORMANCE_plugin_specialization)
# We add this dependency to make sure that DummyPlugins gets generated
# before PERFORMANCE_plugin_specialization so that its auto-generated header is available.
add_dependencies(PERFORMANCE_plugin_specialization GzDummyPlugins)
target_include_directories(PERFORMANCE_plugin_specialization PRIVATE ${PROJECT_SOURCE_DIR}/test)
endif()
6 changes: 0 additions & 6 deletions test/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ target_link_libraries(GzBadPluginSize PRIVATE ${PROJECT_LIBRARY_TARGET_NAME})
add_library(GzDummyPlugins SHARED DummyPlugins.cc)
target_link_libraries(GzDummyPlugins PRIVATE ${PROJECT_LIBRARY_TARGET_NAME})

set_property(TARGET GzBadPluginAlign PROPERTY CXX_STANDARD 11)
set_property(TARGET GzBadPluginAPIVersionNew PROPERTY CXX_STANDARD 11)
set_property(TARGET GzBadPluginAPIVersionOld PROPERTY CXX_STANDARD 11)
set_property(TARGET GzBadPluginSize PROPERTY CXX_STANDARD 11)
set_property(TARGET GzDummyPlugins PROPERTY CXX_STANDARD 11)

# Create a variable for the name of the header which will contain the dummy plugin path.
# This variable gets put in the cache so that it is available at generation time.
set(GZ_DUMMY_PLUGIN_PATH_HEADER "DummyPluginsPath.h" CACHE INTERNAL "Name of header which contains DummyPlugin library path")
Expand Down

0 comments on commit dde439e

Please sign in to comment.