Skip to content

Commit cf671f6

Browse files
committed
Build: Do not request C++11 w/o compiler support.
Also let the user set LUABIND_NO_CXX11 to not use C++11 in any case. Also add a comment to Clang stating that LUABIND_NO_CXX11 *must* be set for Clang versions without support for the -std=c++11 flag because no version detection takes place at the moment.
1 parent 3c6e6da commit cf671f6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@ if (MSVC)
1717
# ("comma operator within array index expression"):
1818
"/wd4709")
1919
else()
20-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11")
2120
# see http://stackoverflow.com/a/11004675/2128694
2221
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
2322
execute_process(
2423
COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
25-
if (GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7)
24+
if (GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7 AND NOT LUABIND_NO_CXX11)
2625
add_definitions("-std=c++11")
2726
endif()
2827
add_definitions("-pedantic" "-Wall" "-Wextra" "-Wcast-align"
@@ -36,8 +35,10 @@ else()
3635
"-Wsign-conversion" "-Wsign-promo"
3736
"-Wstrict-null-sentinel" "-Wstrict-overflow=5"
3837
"-Wno-deprecated-declarations") # auto_ptr is OK for now.
39-
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
40-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
38+
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND NOT LUABIND_NO_CXX11)
39+
# I do not know (a) since when Clang supports this flags and (b) how to
40+
# check Clang's version. Use LUABIND_NO_CXX11 manually if you need to.
41+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
4142
endif ()
4243
endif()
4344

0 commit comments

Comments
 (0)