--- ./CMakeLists.txt.orig 2013-11-26 05:11:29.000000000 +1030 +++ ./CMakeLists.txt 2013-11-28 23:52:39.202491493 +1030 @@ -10,10 +10,8 @@ set (OSO_FILE_VERSION_MAJOR 1) set (OSO_FILE_VERSION_MINOR 0) -cmake_minimum_required (VERSION 2.6) -if (NOT CMAKE_VERSION VERSION_LESS 2.8.4) - cmake_policy (SET CMP0017 NEW) -endif () +cmake_minimum_required (VERSION 2.8.7) +cmake_policy (SET CMP0017 NEW) set (CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE) message (STATUS "Project source dir = ${PROJECT_SOURCE_DIR}") message (STATUS "Project build dir = ${CMAKE_BINARY_DIR}") @@ -22,6 +20,8 @@ message (FATAL_ERROR "Not allowed to run in-source build!") endif () +include (CheckCXXSymbolExists) + if (NOT CMAKE_BUILD_TYPE) set (CMAKE_BUILD_TYPE "Release") endif () @@ -124,12 +124,11 @@ endif () endif () -# Try to detect if this is an OSX distro new enough that the system library -# is libc++, in which case we should force use of Boost Wave (because that -# avoids a nonstandard g++ extension in the other code path). -if (EXISTS "/usr/lib/libc++.dylib" OR OSL_USE_LIBCPP) - set (OSL_SYSTEM_HAS_LIBCPP ON) -endif () +# Try to detect libc++, in which case we should force use of Boost +# Wave (because that avoids a nonstandard g++ extension in the other +# code path). +check_cxx_symbol_exists(_LIBCPP_VERSION string OSL_SYSTEM_HAS_LIBCPP) + set (VERBOSE OFF CACHE BOOL "Print lots of messages while compiling") set (BUILDSTATIC OFF CACHE BOOL "Build static library instead of shared") @@ -167,7 +166,6 @@ if (CMAKE_COMPILER_IS_CLANG AND OSL_USE_LIBCPP) message (STATUS "Using libc++") - add_definitions ("-stdlib=libc++") endif () set (CMAKE_MODULE_PATH @@ -202,6 +200,10 @@ message (STATUS "CMAKE_INSTALL_RPATH = ${CMAKE_INSTALL_RPATH}") +# Try to detect libc++, in which case we should force use of Boost +# Wave (because that avoids a nonstandard g++ extension in the other +# code path). +check_cxx_symbol_exists(_LIBCPP_VERSION string OSL_SYSTEM_HAS_LIBCPP) ########################################################################### if (MSVC) @@ -232,6 +234,13 @@ add_subdirectory (src/include) add_subdirectory (src/doc) +if (USE_BOOST_WAVE) + add_definitions ("-DUSE_BOOST_WAVE") +endif () + +if (CMAKE_COMPILER_IS_CLANG AND OSL_SYSTEM_HAS_LIBCPP) + message (STATUS "Using libc++") +endif () #########################################################################