]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/hana/example/CMakeLists.txt
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / example / CMakeLists.txt
index a2c12710646bdcbede843e1303a676ec87908fd7..20e523862e65316abf51d3711beb882c27017d64 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright Louis Dionne 2013-2016
+# Copyright Louis Dionne 2013-2017
 # Distributed under the Boost Software License, Version 1.0.
 # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
 
@@ -7,10 +7,9 @@ add_dependencies(check examples)
 
 
 ##############################################################################
-# Caveats: Take note of examples that are not supported.
+# Take note of files that depend on Boost
 ##############################################################################
-if (NOT Boost_FOUND)
-    list(APPEND EXCLUDED_EXAMPLES
+list(APPEND EXAMPLES_REQUIRING_BOOST
         "ext/boost/*.cpp"
         "tutorial/appendix_mpl.cpp"
         "tutorial/ext/fusion_to_hana.cpp"
@@ -22,10 +21,19 @@ if (NOT Boost_FOUND)
         "tutorial/quickstart.switchAny.cpp"
         "tutorial/rationale.container.cpp"
         "tutorial/type.cpp"
-        "type/basic_type.cpp"
-    )
+        "type/basic_type.cpp")
+file(GLOB_RECURSE EXAMPLES_REQUIRING_BOOST ${EXAMPLES_REQUIRING_BOOST})
+
+
+##############################################################################
+# Caveats: Take note of examples that are not supported.
+##############################################################################
+if (NOT Boost_FOUND)
+    list(APPEND EXCLUDED_EXAMPLES ${EXAMPLES_REQUIRING_BOOST})
 endif()
 
+list(APPEND EXCLUDED_EXAMPLES "cmake_integration/main.cpp")
+
 
 ##############################################################################
 # Add all the examples
@@ -38,12 +46,19 @@ list(REMOVE_ITEM EXAMPLES "" ${EXCLUDED_EXAMPLES})
 # are useful for illustration, even if the implementation is not actually
 # presented. We don't want to generate warnings for that or need to comment
 # out all unused parameter names.
-boost_hana_append_flag(BOOST_HANA_HAS_WNO_UNUSED_PARAMETER -Wno-unused-parameter)
+include(CheckCXXCompilerFlag)
+check_cxx_compiler_flag(-Wno-unused-parameter BOOST_HANA_HAS_WNO_UNUSED_PARAMETER)
 
 foreach(_file IN LISTS EXAMPLES)
     boost_hana_target_name_for(_target "${_file}")
     add_executable(${_target} EXCLUDE_FROM_ALL "${_file}")
-    target_link_libraries(${_target} hana)
-    boost_hana_add_test(${_target} ${CMAKE_CURRENT_BINARY_DIR}/${_target})
+    add_test(${_target} "${CMAKE_CURRENT_BINARY_DIR}/${_target}")
+    boost_hana_set_test_properties(${_target})
+    if (_file IN_LIST EXAMPLES_REQUIRING_BOOST)
+        target_link_libraries(${_target} PRIVATE Boost::boost)
+    endif()
+    if (BOOST_HANA_HAS_WNO_UNUSED_PARAMETER)
+        target_compile_options(${_target} PRIVATE -Wno-unused-parameter)
+    endif()
     add_dependencies(examples ${_target})
 endforeach()