Skip to content

Commit 93ded01

Browse files
authored
Modernize cmake (#244)
Modernize CMake of the client library with regards to - Properly set C++17 flag using target_compile_features - Properly include googletest e.g. using [CMakeFetchContent](https://google.github.io/googletest/quickstart-cmake.html#set-up-a-project) These proposed changes should make this project easier to maintain and build in different environments.
1 parent 00a2e4f commit 93ded01

File tree

10 files changed

+43
-446
lines changed

10 files changed

+43
-446
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ jobs:
4040
run: |
4141
scripts/start_ursim.sh -m $ROBOT_MODEL -v $URSIM_VERSION -p $PROGRAM_FOLDER -d
4242
env: ${{matrix.env}}
43-
- name: install gtest
44-
run: sudo apt-get install -y libgtest-dev
45-
- name: install boost
46-
run: sudo apt-get install -y libboost-dev
4743
- name: configure
4844
run: mkdir build && cd build && cmake .. -DBUILDING_TESTS=1 -DINTEGRATION_TESTS=1 -DWITH_ASAN=ON
4945
env:

.github/workflows/industrial-ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ jobs:
3636
ROS_DISTRO: ${{matrix.ROS_DISTRO.NAME}}
3737
ROS_REPO: ${{matrix.ROS_REPO}}
3838
CLANG_TIDY: true
39+
CLANG_TIDY_ARGS: '--extra-arg=-std=c++17' # needed for Humble

CMakeLists.txt

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
1-
cmake_minimum_required(VERSION 3.0.2)
1+
cmake_minimum_required(VERSION 3.14.0)
22
project(ur_client_library)
33

4-
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/" ${CMAKE_MODULE_PATH})
5-
64
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
75
message("${PROJECT_NAME}: You did not request a specific build type: selecting 'RelWithDebInfo'.")
86
set(CMAKE_BUILD_TYPE RelWithDebInfo)
97
endif()
108

119
option(WITH_ASAN "Compile with address sanitizer support" OFF)
1210

13-
##
14-
## Check C++11 support / enable global pedantic and Wall
15-
##
16-
include(DefineCXX17CompilerFlag)
17-
DEFINE_CXX_17_COMPILER_FLAG(CXX17_FLAG)
18-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
19-
2011
add_library(urcl SHARED
2112
src/comm/tcp_socket.cpp
2213
src/comm/tcp_server.cpp
@@ -52,7 +43,7 @@ add_library(urcl SHARED
5243
)
5344
add_library(ur_client_library::urcl ALIAS urcl)
5445
target_compile_options(urcl PRIVATE -Wall -Wextra -Wno-unused-parameter)
55-
target_compile_options(urcl PUBLIC ${CXX17_FLAG})
46+
target_compile_features(urcl PUBLIC cxx_std_17)
5647
if(WITH_ASAN)
5748
target_compile_options(urcl PUBLIC -fsanitize=address)
5849
target_link_options(urcl PUBLIC -fsanitize=address)

CMakeModules/DefineCXX11CompilerFlag.cmake

Lines changed: 0 additions & 55 deletions
This file was deleted.

CMakeModules/DefineCXX14CompilerFlag.cmake

Lines changed: 0 additions & 55 deletions
This file was deleted.

CMakeModules/DefineCXX17CompilerFlag.cmake

Lines changed: 0 additions & 55 deletions
This file was deleted.

CMakeModules/FindGTest.CMakeLists.txt.in

Lines changed: 0 additions & 15 deletions
This file was deleted.

CMakeModules/FindGTestPackage.cmake

Lines changed: 0 additions & 128 deletions
This file was deleted.

0 commit comments

Comments
 (0)