Skip to content

Commit

Permalink
Removed the explicit '-std=c++14' compile flag (#119)
Browse files Browse the repository at this point in the history
* Removed the explicit '-std=c++14' compile flag
* Changed the CXX_STANDARD setting to be per-target instead of global
* Added the CXX_STANDARD_REQUIRED setting to all targets
  • Loading branch information
svwilliams committed Nov 26, 2019
1 parent a4ffe05 commit 044bb16
Show file tree
Hide file tree
Showing 8 changed files with 341 additions and 80 deletions.
68 changes: 66 additions & 2 deletions fuse_constraints/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ catkin_package(
###########
## Build ##
###########
set(CMAKE_CXX_STANDARD 14)
add_compile_options(-std=c++14 -Wall -Werror)
add_compile_options(-Wall -Werror)

# fuse_constraints library
add_library(${PROJECT_NAME}
Expand Down Expand Up @@ -75,6 +74,11 @@ target_link_libraries(${PROJECT_NAME}
${EIGEN3_LIBRARIES}
${SUITESPARSE_LIBRARIES}
)
set_target_properties(${PROJECT_NAME}
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

#############
## Install ##
Expand Down Expand Up @@ -127,6 +131,11 @@ if(CATKIN_ENABLE_TESTING)
${catkin_LIBRARIES}
${CERES_LIBRARIES}
)
set_target_properties(test_absolute_constraint
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# Absolute Orientation 3D Stamped Constraint Tests
catkin_add_gtest(test_absolute_orientation_3d_stamped_constraint
Expand All @@ -148,6 +157,11 @@ if(CATKIN_ENABLE_TESTING)
${CERES_LIBRARIES}
${EIGEN3_LIBRARIES}
)
set_target_properties(test_absolute_orientation_3d_stamped_constraint
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# Absolute Orientation 3D Stamped Euler Constraint Tests
catkin_add_gtest(test_absolute_orientation_3d_stamped_euler_constraint
Expand All @@ -169,6 +183,11 @@ if(CATKIN_ENABLE_TESTING)
${CERES_LIBRARIES}
${EIGEN3_LIBRARIES}
)
set_target_properties(test_absolute_orientation_3d_stamped_euler_constraint
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# Absolute Pose 2D Stamped Constraint Tests
catkin_add_gtest(test_absolute_pose_2d_stamped_constraint
Expand All @@ -188,6 +207,11 @@ if(CATKIN_ENABLE_TESTING)
${catkin_LIBRARIES}
${CERES_LIBRARIES}
)
set_target_properties(test_absolute_pose_2d_stamped_constraint
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# Absolute Pose 3D Stamped Constraint Tests
catkin_add_gtest(test_absolute_pose_3d_stamped_constraint
Expand All @@ -207,6 +231,11 @@ if(CATKIN_ENABLE_TESTING)
${catkin_LIBRARIES}
${CERES_LIBRARIES}
)
set_target_properties(test_absolute_pose_3d_stamped_constraint
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# Marginal Constraint Tests
catkin_add_gtest(test_marginal_constraint
Expand All @@ -224,6 +253,11 @@ if(CATKIN_ENABLE_TESTING)
${PROJECT_NAME}
${catkin_LIBRARIES}
)
set_target_properties(test_marginal_constraint
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# Marginalize Variables Tests
catkin_add_gtest(test_marginalize_variables
Expand All @@ -242,6 +276,11 @@ if(CATKIN_ENABLE_TESTING)
${PROJECT_NAME}
${catkin_LIBRARIES}
)
set_target_properties(test_marginalize_variables
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# Relative Constraint Tests
catkin_add_gtest(test_relative_constraint
Expand All @@ -261,6 +300,11 @@ if(CATKIN_ENABLE_TESTING)
${catkin_LIBRARIES}
${CERES_LIBRARIES}
)
set_target_properties(test_relative_constraint
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# Relative Pose 2D Stamped Constraint Tests
catkin_add_gtest(test_relative_pose_2d_stamped_constraint
Expand All @@ -280,6 +324,11 @@ if(CATKIN_ENABLE_TESTING)
${catkin_LIBRARIES}
${CERES_LIBRARIES}
)
set_target_properties(test_relative_pose_2d_stamped_constraint
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# Relative Pose 3D Stamped Constraint Tests
catkin_add_gtest(test_relative_pose_3d_stamped_constraint
Expand All @@ -299,6 +348,11 @@ if(CATKIN_ENABLE_TESTING)
${catkin_LIBRARIES}
${CERES_LIBRARIES}
)
set_target_properties(test_relative_pose_3d_stamped_constraint
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# UuidOrdering Tests
catkin_add_gtest(test_uuid_ordering
Expand All @@ -313,6 +367,11 @@ if(CATKIN_ENABLE_TESTING)
${PROJECT_NAME}
${catkin_LIBRARIES}
)
set_target_properties(test_uuid_ordering
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# VariableConstraints Tests
catkin_add_gtest(test_variable_constraints
Expand All @@ -325,4 +384,9 @@ if(CATKIN_ENABLE_TESTING)
target_link_libraries(test_variable_constraints
${PROJECT_NAME}
)
set_target_properties(test_variable_constraints
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)
endif()
73 changes: 71 additions & 2 deletions fuse_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ find_package(catkin REQUIRED COMPONENTS
find_package(Boost REQUIRED COMPONENTS serialization)
find_package(Ceres REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(libglog REQUIRED)

catkin_package(
INCLUDE_DIRS
Expand All @@ -25,13 +27,13 @@ catkin_package(
Boost
CERES
EIGEN3
GLOG
)

###########
## Build ##
###########
set(CMAKE_CXX_STANDARD 14)
add_compile_options(-std=c++14 -Wall -Werror)
add_compile_options(-Wall -Werror)

## fuse_core library
add_library(${PROJECT_NAME}
Expand Down Expand Up @@ -59,11 +61,18 @@ target_include_directories(${PROJECT_NAME}
${catkin_INCLUDE_DIRS}
${CERES_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
${GLOG_INCLUDE_DIRS}
)
target_link_libraries(${PROJECT_NAME}
${Boost_LIBRARIES}
${catkin_LIBRARIES}
${CERES_LIBRARIES}
${GLOG_LIBRARIES}
)
set_target_properties(${PROJECT_NAME}
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# fuse_echo executable
Expand All @@ -82,6 +91,11 @@ target_link_libraries(fuse_echo
${PROJECT_NAME}
${catkin_LIBRARIES}
)
set_target_properties(fuse_echo
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

#############
## Install ##
Expand Down Expand Up @@ -137,6 +151,11 @@ if(CATKIN_ENABLE_TESTING)
${PROJECT_NAME}
${catkin_LIBRARIES}
)
set_target_properties(test_async_motion_model
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# AsyncPublisher tests
add_rostest_gtest(test_async_publisher
Expand All @@ -158,6 +177,11 @@ if(CATKIN_ENABLE_TESTING)
${PROJECT_NAME}
${catkin_LIBRARIES}
)
set_target_properties(test_async_publisher
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# AsyncSensorModel tests
add_rostest_gtest(test_async_sensor_model
Expand All @@ -179,6 +203,11 @@ if(CATKIN_ENABLE_TESTING)
${PROJECT_NAME}
${catkin_LIBRARIES}
)
set_target_properties(test_async_sensor_model
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# CallbackWrapper tests
add_rostest_gtest(test_callback_wrapper
Expand All @@ -199,6 +228,11 @@ if(CATKIN_ENABLE_TESTING)
target_link_libraries(test_callback_wrapper
${catkin_LIBRARIES}
)
set_target_properties(test_callback_wrapper
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# Constraint tests
catkin_add_gtest(test_constraint
Expand All @@ -219,6 +253,11 @@ if(CATKIN_ENABLE_TESTING)
target_link_libraries(test_constraint
${PROJECT_NAME}
)
set_target_properties(test_constraint
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# Local Parameterization tests
catkin_add_gtest(test_local_parameterization
Expand All @@ -231,6 +270,11 @@ if(CATKIN_ENABLE_TESTING)
target_link_libraries(test_local_parameterization
${PROJECT_NAME}
)
set_target_properties(test_local_parameterization
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# Message Buffer Tests
catkin_add_gtest(test_message_buffer
Expand All @@ -250,6 +294,11 @@ if(CATKIN_ENABLE_TESTING)
target_link_libraries(test_message_buffer
${catkin_LIBRARIES}
)
set_target_properties(test_message_buffer
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# Timestamp Manager Tests
catkin_add_gtest(test_timestamp_manager
Expand All @@ -270,6 +319,11 @@ if(CATKIN_ENABLE_TESTING)
${PROJECT_NAME}
${catkin_LIBRARIES}
)
set_target_properties(test_timestamp_manager
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# Transaction tests
catkin_add_gtest(test_transaction
Expand All @@ -291,6 +345,11 @@ if(CATKIN_ENABLE_TESTING)
${PROJECT_NAME}
${catkin_LIBRARIES}
)
set_target_properties(test_transaction
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# UUID tests
catkin_add_gtest(test_uuid
Expand All @@ -311,6 +370,11 @@ if(CATKIN_ENABLE_TESTING)
${PROJECT_NAME}
${catkin_LIBRARIES}
)
set_target_properties(test_uuid
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

# Variable tests
catkin_add_gtest(test_variable
Expand All @@ -331,4 +395,9 @@ if(CATKIN_ENABLE_TESTING)
target_link_libraries(test_variable
${PROJECT_NAME}
)
set_target_properties(test_variable
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)
endif()
13 changes: 11 additions & 2 deletions fuse_graphs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ catkin_package(
###########
## Build ##
###########
set(CMAKE_CXX_STANDARD 14)
add_compile_options(-std=c++14 -Wall -Werror)
add_compile_options(-Wall -Werror)

## fuse_graphs library
add_library(${PROJECT_NAME}
Expand All @@ -49,6 +48,11 @@ target_link_libraries(${PROJECT_NAME}
${catkin_LIBRARIES}
${CERES_LIBRARIES}
)
set_target_properties(${PROJECT_NAME}
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)

#############
## Install ##
Expand Down Expand Up @@ -103,4 +107,9 @@ if(CATKIN_ENABLE_TESTING)
${PROJECT_NAME}
${catkin_LIBRARIES}
)
set_target_properties(test_hash_graph
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)
endif()

0 comments on commit 044bb16

Please sign in to comment.