~mysql/mysql-connector-cpp/trunk

« back to all changes in this revision

Viewing changes to CMakeLists.txt

  • Committer: Hemant Dangi
  • Date: 2014-12-17 16:28:39 UTC
  • Revision ID: hemant.dangi@oracle.com-20141217162839-sdbpj3fcwn5gxjxh
Bug #75251: Add C++11 support and replace (deprecated in C++11) auto_ptr

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
 
64
64
#-----------------
65
65
# CPPFLAGS, CXXFLAGS and LDFLAGS from the environment
 
66
IF(CMAKE_ENABLE_C++11)
 
67
  INCLUDE(CheckCXXCompilerFlag)
 
68
  CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
 
69
  CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
 
70
  IF(COMPILER_SUPPORTS_CXX11)
 
71
    MESSAGE(STATUS "Compiler supports C++11. Adding -std=c++11 flags")
 
72
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
 
73
  ELSEIF(COMPILER_SUPPORTS_CXX0X)
 
74
    MESSAGE(STATUS "Compiler supports C++11. Adding -std=c++0x flag.")
 
75
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
 
76
  ELSE()
 
77
    MESSAGE(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} doesn't support C++11. Please use a different compiler.")
 
78
  ENDIF(COMPILER_SUPPORTS_CXX11)
 
79
ENDIF(CMAKE_ENABLE_C++11)
 
80
 
66
81
SET(MYSQLCPPCONN_COMPILE_FLAGS_ENV "$ENV{CPPFLAGS} ${MYSQL_CXXFLAGS} $ENV{CXXFLAGS}")
67
82
MESSAGE(STATUS "Environment compile flags: ${MYSQLCPPCONN_COMPILE_FLAGS_ENV}")
68
83