Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wolf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
wolf
Commits
08b9ca3c
Commit
08b9ca3c
authored
1 year ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
Draft: Resolve "CMAKE version"
parent
31d15fa1
No related branches found
No related tags found
4 merge requests
!476
spdlog version upgrade
,
!473
Rerefactor
,
!472
Merge ProcessorLandmarkExternal
,
!471
Resolve "CMAKE version"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+1
-1
1 addition, 1 deletion
CMakeLists.txt
test/gtest/CMakeLists.txt
+9
-67
9 additions, 67 deletions
test/gtest/CMakeLists.txt
with
10 additions
and
68 deletions
CMakeLists.txt
+
1
−
1
View file @
08b9ca3c
...
...
@@ -2,7 +2,7 @@
MESSAGE
(
STATUS
"Starting WOLF CMakeLists ..."
)
# Pre-requisites about cmake itself
CMAKE_MINIMUM_REQUIRED
(
VERSION 3.1
0
)
CMAKE_MINIMUM_REQUIRED
(
VERSION 3.1
6
)
# MAC OSX RPATH
SET
(
CMAKE_MACOSX_RPATH 1
)
...
...
This diff is collapsed.
Click to expand it.
test/gtest/CMakeLists.txt
+
9
−
67
View file @
08b9ca3c
if
(
${
CMAKE_VERSION
}
VERSION_LESS
"3.11.0"
)
message
(
"CMake version less than 3.11.0"
)
include
(
FetchContent
)
# Enable ExternalProject CMake module
include
(
ExternalProject
)
FetchContent_Declare
(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG main
)
set
(
GTEST_FORCE_SHARED_CRT ON
)
set
(
GTEST_DISABLE_PTHREADS ON
)
# without this in ubuntu 18.04 we get linking errors
# Download GoogleTest
ExternalProject_Add
(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.8.x
# TIMEOUT 1 # We'll try this
CMAKE_ARGS -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG:PATH=DebugLibs
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE:PATH=ReleaseLibs
-DCMAKE_CXX_FLAGS=
${
MSVC_COMPILER_DEFS
}
-Dgtest_force_shared_crt=
${
GTEST_FORCE_SHARED_CRT
}
-Dgtest_disable_pthreads=
${
GTEST_DISABLE_PTHREADS
}
-DBUILD_GTEST=ON
PREFIX
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
# Disable install step
INSTALL_COMMAND
""
UPDATE_DISCONNECTED 1
# 1: do not update googletest; 0: update googletest via github
)
# Get GTest source and binary directories from CMake project
# Specify include dir
ExternalProject_Get_Property
(
googletest source_dir
)
set
(
GTEST_INCLUDE_DIRS
${
source_dir
}
/googletest/include PARENT_SCOPE
)
# Specify MainTest's link libraries
ExternalProject_Get_Property
(
googletest binary_dir
)
set
(
GTEST_LIBS_DIR
${
binary_dir
}
/googlemock/gtest PARENT_SCOPE
)
# Create a libgtest target to be used as a dependency by test programs
add_library
(
libgtest IMPORTED STATIC GLOBAL
)
add_dependencies
(
libgtest googletest
)
# Set libgtest properties
set_target_properties
(
libgtest PROPERTIES
"IMPORTED_LOCATION"
"
${
binary_dir
}
/googlemock/gtest/libgtest.a"
"IMPORTED_LINK_INTERFACE_LIBRARIES"
"
${
CMAKE_THREAD_LIBS_INIT
}
"
)
else
()
message
(
"CMake version equal or greater than 3.11.0"
)
include
(
FetchContent
)
FetchContent_Declare
(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG main
)
SET
(
INSTALL_GTEST OFF
)
# Disable installation of googletest
FetchContent_MakeAvailable
(
googletest
)
endif
()
SET
(
INSTALL_GTEST OFF
)
# Disable installation of googletest
FetchContent_MakeAvailable
(
googletest
)
function
(
wolf_add_gtest target
)
add_executable
(
${
target
}
${
ARGN
}
)
if
(
${
CMAKE_VERSION
}
VERSION_LESS
"3.11.0"
)
add_dependencies
(
${
target
}
libgtest
)
target_link_libraries
(
${
target
}
PUBLIC libgtest
${
PLUGIN_NAME
}
)
target_include_directories
(
${
target
}
PUBLIC
${
GTEST_INCLUDE_DIRS
}
)
else
()
target_link_libraries
(
${
target
}
PUBLIC gtest_main
${
PLUGIN_NAME
}
)
endif
()
target_link_libraries
(
${
target
}
PUBLIC gtest_main
${
PLUGIN_NAME
}
)
add_test
(
NAME
${
target
}
COMMAND
${
target
}
)
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