Closed PeterBowman closed 6 years ago
From cmake/YarpSystemCheck.cmake
at current YARP devel (2.3.71, ref):
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON)
On my PC (Ubuntu 16.04), this adds a -std=gnu++11
to client code. On Travis (Ubuntu 14.04), such option is not recognized (ref) and compilation fails.
https://cmake.org/cmake/help/v3.1/prop_tgt/CXX_STANDARD.html
On Travis (Ubuntu 14.04), such option is not recognized (ref) and compilation fails.
Not anymore! Trusty images on Travis now use gcc 4.8.4 (ref). In fact, I already pointed this out on https://github.com/roboticslab-uc3m/gait/issues/6#issuecomment-292308644, which means that this comment was clearly outdated.
Closing, a recent CMake code review (#105) fixed this.
Note to self, this is currently set at libYARP_OS/CMakeLists.txt
(devel branch, ref):
if(CMAKE_VERSION VERSION_LESS 3.1)
if(DEFINED CXX11_FLAGS)
target_compile_options(YARP_OS PUBLIC ${CXX11_FLAGS})
endif()
else()
target_compile_features(YARP_OS PUBLIC cxx_nullptr
cxx_override
cxx_rvalue_references)
endif()
https://cmake.org/cmake/help/v3.1/command/target_compile_features.html
Another note to expand on what's happening under the hood. This is an excerpt from YARPTargets.cmake when configured on a system with CMake 3.1+ (supports target_compile_features
):
# Create imported target YARP::YARP_OS
add_library(YARP::YARP_OS SHARED IMPORTED)
set_target_properties(YARP::YARP_OS PROPERTIES
INTERFACE_COMPILE_FEATURES "cxx_nullptr;cxx_override;cxx_rvalue_references"
INTERFACE_INCLUDE_DIRECTORIES "/home/bartek/git/yarp/src/libYARP_OS/include"
INTERFACE_LINK_LIBRARIES "YARP::YARP_conf"
)
When built with CMake <3.1, it's smart enough to define INTERFACE_COMPILE_OPTIONS
instead of INTERFACE_COMPILE_FEATURES
, setting (depends on the compiler, I guess) -std=c++11
. In fact, I did see a std=gnu++11
option propagated down to the RD targets.
See also: https://cmake.org/cmake/help/v3.1/manual/cmake-compile-features.7.html.
All Travis CI cron jobs pull YARP's
devel
branch (currently at v2.3.71 (unstable)), which causes them to fail:https://travis-ci.org/asrob-uc3m/robotDevastation/builds/291473501
Note that future YARP releases (2.3.72 onwards) will need C++11 for using YARP, not just compiling it:
https://github.com/robotology/yarp/blob/31a9e88/doc/release/v2_3_72.md#important-changes