Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bodydynamics
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile_robotics
wolf_projects
wolf_lib
plugins
bodydynamics
Commits
c49c0d5e
Commit
c49c0d5e
authored
3 years ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
disabling gtest pthreads in cmake<3.11
parent
1717bdd3
No related branches found
No related tags found
2 merge requests
!23
After cmake and const refactor
,
!22
Resolve "Adapt to core cmake refactor"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/CMakeLists.txt
+5
-2
5 additions, 2 deletions
test/CMakeLists.txt
test/gtest/CMakeLists.txt
+10
-12
10 additions, 12 deletions
test/gtest/CMakeLists.txt
with
15 additions
and
14 deletions
test/CMakeLists.txt
+
5
−
2
View file @
c49c0d5e
# Retrieve googletest from github & compile
# Retrieve googletest from github & compile
add_subdirectory
(
gtest
)
add_subdirectory
(
gtest
)
#############
#### ADD YOUR TESTS BELOW ###
#################
#############
USE THIS TEST AS AN EXAMPLE
#################
# #
# #
# ==== IN ALPHABETICAL ORDER! ==== #
# Create a specific test executable for gtest_example #
# wolf_add_gtest(gtest_example gtest_example.cpp) #
# #
# #
###########################################################
wolf_add_gtest
(
gtest_capture_inertial_kinematics gtest_capture_inertial_kinematics.cpp
)
wolf_add_gtest
(
gtest_capture_inertial_kinematics gtest_capture_inertial_kinematics.cpp
)
wolf_add_gtest
(
gtest_capture_leg_odom gtest_capture_leg_odom.cpp
)
wolf_add_gtest
(
gtest_capture_leg_odom gtest_capture_leg_odom.cpp
)
...
...
This diff is collapsed.
Click to expand it.
test/gtest/CMakeLists.txt
+
10
−
12
View file @
c49c0d5e
...
@@ -5,15 +5,7 @@ if(${CMAKE_VERSION} VERSION_LESS "3.11.0")
...
@@ -5,15 +5,7 @@ if(${CMAKE_VERSION} VERSION_LESS "3.11.0")
include
(
ExternalProject
)
include
(
ExternalProject
)
set
(
GTEST_FORCE_SHARED_CRT ON
)
set
(
GTEST_FORCE_SHARED_CRT ON
)
set
(
GTEST_DISABLE_PTHREADS OFF
)
set
(
GTEST_DISABLE_PTHREADS ON
)
# without this in ubuntu 18.04 we get linking errors
# For some reason I need to disable PTHREADS
# with g++ (Ubuntu 4.9.3-8ubuntu2~14.04) 4.9.3
# This is a known issue for MinGW :
# https://github.com/google/shaderc/pull/174
#if(MINGW)
# set(GTEST_DISABLE_PTHREADS ON)
#endif()
# Download GoogleTest
# Download GoogleTest
ExternalProject_Add
(
googletest
ExternalProject_Add
(
googletest
...
@@ -63,7 +55,13 @@ else()
...
@@ -63,7 +55,13 @@ else()
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG main
)
GIT_TAG main
)
FetchContent_MakeAvailable
(
googletest
)
#FetchContent_MakeAvailable(googletest)
# Disable installation of googletest: https://stackoverflow.com/questions/65527126/disable-install-for-fetchcontent
FetchContent_GetProperties
(
googletest
)
if
(
NOT googletest_POPULATED
)
FetchContent_Populate
(
googletest
)
add_subdirectory
(
${
googletest_SOURCE_DIR
}
${
googletest_BINARY_DIR
}
EXCLUDE_FROM_ALL
)
endif
()
endif
()
endif
()
...
@@ -71,10 +69,10 @@ function(wolf_add_gtest target)
...
@@ -71,10 +69,10 @@ function(wolf_add_gtest target)
add_executable
(
${
target
}
${
ARGN
}
)
add_executable
(
${
target
}
${
ARGN
}
)
if
(
${
CMAKE_VERSION
}
VERSION_LESS
"3.11.0"
)
if
(
${
CMAKE_VERSION
}
VERSION_LESS
"3.11.0"
)
add_dependencies
(
${
target
}
libgtest
)
add_dependencies
(
${
target
}
libgtest
)
target_link_libraries
(
${
target
}
libgtest
${
PLUGIN_NAME
}
)
target_link_libraries
(
${
target
}
PUBLIC
libgtest
${
PLUGIN_NAME
}
)
target_include_directories
(
${
target
}
PUBLIC
${
GTEST_INCLUDE_DIRS
}
)
target_include_directories
(
${
target
}
PUBLIC
${
GTEST_INCLUDE_DIRS
}
)
else
()
else
()
target_link_libraries
(
${
target
}
gtest_main
${
PLUGIN_NAME
}
)
target_link_libraries
(
${
target
}
PUBLIC
gtest_main
${
PLUGIN_NAME
}
)
endif
()
endif
()
add_test
(
NAME
${
target
}
COMMAND
${
target
}
)
add_test
(
NAME
${
target
}
COMMAND
${
target
}
)
endfunction
()
endfunction
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment