Skip to content

Commit

Permalink
Turn on C++11 support for GCC and Clang
Browse files Browse the repository at this point in the history
  • Loading branch information
ianrrees committed Jan 30, 2016
1 parent 645a83a commit 8219102
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Expand Up @@ -46,6 +46,7 @@ endif(WIN32)

if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
set(CMAKE_COMPILER_IS_CLANGXX TRUE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
Expand All @@ -60,6 +61,15 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
endif(UNIX)
endif(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)

IF(CMAKE_COMPILER_IS_GNUCXX)
EXECUTE_PROCESS( COMMAND ${CMAKE_C_COMPILER} -dumpversion
OUTPUT_VARIABLE GCC_VERSION )
IF(GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7)
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
ELSE(GCC_VERSION)
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
ENDIF(GCC_VERSION)
ENDIF()

# ================================================================================
# Output directories for install target
Expand Down
2 changes: 1 addition & 1 deletion src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp
Expand Up @@ -6017,7 +6017,7 @@ SMESH_MeshEditor::Sew_Error
// sew the border to the side 2
// ============================

int nbNodes[] = { nSide[0].size(), nSide[1].size() };
int nbNodes[] = { (int)nSide[0].size(), (int)nSide[1].size() };
int maxNbNodes = Max( nbNodes[0], nbNodes[1] );

TListOfListOfNodes nodeGroupsToMerge;
Expand Down

3 comments on commit 8219102

@yorikvanhavre
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get this warning, not important, but not sure how to make it disappear... should it be ENDIF(GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7) maybe?

CMake Warning (dev) in CMakeLists.txt:
  A logical block opening on the line

    /home/yorik/Sources/FreeCAD/CMakeLists.txt:67 (IF)

  closes on the line

    /home/yorik/Sources/FreeCAD/CMakeLists.txt:71 (ENDIF)

  with mis-matching arguments.
This warning is for project developers.  Use -Wno-dev to suppress it.

@j-wiedemann
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the same message, and I get segfault when I start to draw anything.
Compil of commit just before run ok.
Ubuntu 14.04.3 Kernel 3.19
└─ $ ▶ cmake --version
cmake version 2.8.12.2

@peterlama
Copy link
Contributor

@peterlama peterlama commented on 8219102 Feb 1, 2016 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.