discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More on C++11 requirements


From: Marcus D Leech
Subject: Re: More on C++11 requirements
Date: Mon, 25 Nov 2019 12:37:38 -0500

Thanks. 

I got around the issue by explicitly setting CMAKE_CXX_CFLAGS when I invoked cmake. 

Sent from my iPhone

On Nov 25, 2019, at 10:19 AM, Michael Dickens <address@hidden> wrote:


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 <address@hidden> 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: address@hidden
Web: https://ettus.com/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]