aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwsnipex <wsnipex@a1.net>2015-02-19 10:35:07 +0100
committermontellese <montellese@xbmc.org>2015-03-01 20:43:46 +0100
commite095d04ca39f84012acfc7a36dc5629cb74364c7 (patch)
tree0b7d401f12691c1b4d08e03ea4018171784c65c2
parente9cf37c88f7873b470424dd37b5f07d75988b006 (diff)
cmake: add C++11 flag
-rw-r--r--m4/ax_cxx_compile_stdcxx_11.m44
-rw-r--r--project/cmake/kodi-config.cmake.in3
-rw-r--r--project/cmake/scripts/common/prepare-env.cmake10
3 files changed, 16 insertions, 1 deletions
diff --git a/m4/ax_cxx_compile_stdcxx_11.m4 b/m4/ax_cxx_compile_stdcxx_11.m4
index 2bc054d981..cee493a1ef 100644
--- a/m4/ax_cxx_compile_stdcxx_11.m4
+++ b/m4/ax_cxx_compile_stdcxx_11.m4
@@ -97,6 +97,8 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
CXXFLAGS="$ac_save_CXXFLAGS"])
if eval test x\$$cachevar = xyes; then
CXXFLAGS="$CXXFLAGS $switch"
+ CXX11_SWITCH="$switch"
+ AC_SUBST(CXX11_SWITCH)
ac_success=yes
break
fi
@@ -117,6 +119,8 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
CXXFLAGS="$ac_save_CXXFLAGS"])
if eval test x\$$cachevar = xyes; then
CXXFLAGS="$CXXFLAGS $switch"
+ CXX11_SWITCH="$switch"
+ AC_SUBST(CXX11_SWITCH)
ac_success=yes
break
fi
diff --git a/project/cmake/kodi-config.cmake.in b/project/cmake/kodi-config.cmake.in
index 50e12a8a71..0e3b1580ad 100644
--- a/project/cmake/kodi-config.cmake.in
+++ b/project/cmake/kodi-config.cmake.in
@@ -2,6 +2,9 @@ SET(KODI_INCLUDE_DIR @prefix@/include)
SET(APP_NAME @APP_NAME@)
SET(APP_VERSION_MAJOR @APP_VERSION_MAJOR@)
SET(APP_VERSION_MINOR @APP_VERSION_MINOR@)
+IF(NOT WIN32)
+ SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} @CXX11_SWITCH@")
+ENDIF()
LIST(APPEND CMAKE_MODULE_PATH @prefix@/lib/kodi)
ADD_DEFINITIONS(@ARCH_DEFINES@)
diff --git a/project/cmake/scripts/common/prepare-env.cmake b/project/cmake/scripts/common/prepare-env.cmake
index 7edc54a78f..7df421cfc1 100644
--- a/project/cmake/scripts/common/prepare-env.cmake
+++ b/project/cmake/scripts/common/prepare-env.cmake
@@ -41,6 +41,14 @@ if(NOT EXISTS "${XBMC_INCLUDE_DIR}/")
file(MAKE_DIRECTORY ${XBMC_INCLUDE_DIR})
endif()
+# make sure C++11 is always set
+if(NOT WIN32)
+ string(REGEX MATCH "-std=(gnu|c)\\+\\+11" cxx11flag "${CMAKE_CXX_FLAGS}")
+ if(NOT cxx11flag)
+ set(CXX11_SWITCH "-std=c++11")
+ endif()
+endif()
+
# kodi-config.cmake.in (further down) expects a "prefix" variable
get_filename_component(prefix "${DEPENDS_PATH}" ABSOLUTE)
@@ -77,4 +85,4 @@ foreach(binding ${bindings})
#endif
#include \"kodi/${headerfile}\"")
endif()
-endforeach() \ No newline at end of file
+endforeach()