If setting `CMAKE_CXX_STANDARD` doesn't work to get `-std=c++11` or
`-std=gnu++11` into the CXX_FLAGS, then maybe the version of CMake is <
3.1.0?

The variable `CMAKE_CXX_STANDARD` was added to CMake in the capacity of
setting (e.g.) `-std=c++11` as of CMake 3.1.0. The code would be something
like:
{{{
# If cmake version is < 3.1, explicitly set C/C++ standard to use;
# this CMake doesn't internally use CMAKE_C*_STANDARD variables.

IF(${CMAKE_VERSION} VERSION_LESS 3.1)
    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c${CMAKE_C_STANDARD}")
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++${CMAKE_CXX_STANDARD}")
ENDIF()
}}}

Worth a try! - MLD

On Sun, Nov 24, 2019 at 5:22 PM Marcus D. Leech <patchvonbr...@gmail.com>
wrote:

> Playing with a project (gr-radio_astro from WVURAIL:
> https://github.com/WVURAIL/gr-radio_astro), and running into compile
> issues on
>     older OS (Fedora 20 in this case).
>
> Now, the interesting thing is that my GCC appears to have support for
> c++11  (since -std=c++11 works as a command arg), and despite the
>    fact that the CMakelists.txt file for the project includes:
>
> ########################################################################
> # Compiler specific setup
> ########################################################################
> if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
>      #http://gcc.gnu.org/wiki/Visibility
>      add_definitions(-fvisibility=hidden)
>      set(CMAKE_CXX_STANDARD 11)
> endif()
>
> There doesn't appear to be any use of -std=c++11   in the Make files
> generated, and one gets compile errors for source that includes
>    C++11 features/syntax.
>
> Are there extra "sets" in the CMakeLists.txt that I should be using to
> force it to use the c++11 compiler options?
>
> Cheers

-- 
Michael Dickens
Ettus Research Technical Support
Email: supp...@ettus.com
Web: https://ettus.com/

Reply via email to