PingLiuPing commented on code in PR #936:
URL: https://github.com/apache/iceberg-cpp/pull/936#discussion_r4119045023
##########
example/CMakeLists.txt:
##########
@@ -20,13 +20,79 @@ cmake_minimum_required(VERSION 3.25)
project(example)
-set(CMAKE_CXX_STANDARD 23)
+# C++20 is the minimum standard iceberg-cpp's public headers support, so the
+# example builds as C++20 by default to keep that contract exercised. Set this
to
+# 23 to also check the headers from a C++23 consumer.
+set(ICEBERG_EXAMPLE_CXX_STANDARD
+ 20
+ CACHE STRING "C++ standard used to build the example (20 or 23)")
+set_property(CACHE ICEBERG_EXAMPLE_CXX_STANDARD PROPERTY STRINGS 20 23)
+if(NOT ICEBERG_EXAMPLE_CXX_STANDARD MATCHES "^(20|23)$")
+ message(FATAL_ERROR "ICEBERG_EXAMPLE_CXX_STANDARD must be 20 or 23, got "
+ "'${ICEBERG_EXAMPLE_CXX_STANDARD}'")
+endif()
+
+set(CMAKE_CXX_STANDARD ${ICEBERG_EXAMPLE_CXX_STANDARD})
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_CXX_EXTENSIONS OFF)
find_package(iceberg CONFIG REQUIRED COMPONENTS bundle rest)
+if(TARGET iceberg::iceberg_bundle_shared)
+ set(ICEBERG_BUNDLE_TARGET iceberg::iceberg_bundle_shared)
+else()
+ set(ICEBERG_BUNDLE_TARGET iceberg::iceberg_bundle_static)
+endif()
+
+if(TARGET iceberg::iceberg_rest_shared)
+ set(ICEBERG_REST_TARGET iceberg::iceberg_rest_shared)
+else()
+ set(ICEBERG_REST_TARGET iceberg::iceberg_rest_static)
+endif()
+
add_executable(demo_example demo_example.cc)
-target_link_libraries(demo_example
- PRIVATE
"$<IF:$<TARGET_EXISTS:iceberg::iceberg_bundle_shared>,iceberg::iceberg_bundle_shared,iceberg::iceberg_bundle_static>"
-
"$<IF:$<TARGET_EXISTS:iceberg::iceberg_rest_shared>,iceberg::iceberg_rest_shared,iceberg::iceberg_rest_static>"
-)
+target_link_libraries(demo_example PRIVATE ${ICEBERG_BUNDLE_TARGET}
+ ${ICEBERG_REST_TARGET})
+
+# Compile every installed public header as a consumer using
+# ICEBERG_EXAMPLE_CXX_STANDARD. The installed include
+# tree is the public API contract: iceberg_install_all_headers excludes
internal
+# headers before packaging them.
+get_target_property(ICEBERG_BUNDLE_INCLUDE_DIRS ${ICEBERG_BUNDLE_TARGET}
+ INTERFACE_INCLUDE_DIRECTORIES)
+foreach(ICEBERG_INCLUDE_DIR IN LISTS ICEBERG_BUNDLE_INCLUDE_DIRS)
+ if(EXISTS "${ICEBERG_INCLUDE_DIR}/iceberg")
+ set(ICEBERG_PUBLIC_INCLUDE_DIR "${ICEBERG_INCLUDE_DIR}")
+ break()
+ endif()
+endforeach()
+
+if(NOT ICEBERG_PUBLIC_INCLUDE_DIR)
+ message(FATAL_ERROR "Could not locate iceberg's installed public headers")
+endif()
+
+file(GLOB_RECURSE
+ ICEBERG_PUBLIC_HEADERS
+ CONFIGURE_DEPENDS
+ "${ICEBERG_PUBLIC_INCLUDE_DIR}/iceberg/*.h"
+ "${ICEBERG_PUBLIC_INCLUDE_DIR}/iceberg/*.hpp")
Review Comment:
Thanks, checked the source code and no .hpp headers, removed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]