pineapple/externals/vcpkg/ports/s2geometry/CMakeLists.txt.patch
2022-07-23 03:01:36 +02:00

118 lines
4.1 KiB
Diff
Executable file

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5ecd280..9859890 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,16 +20,8 @@ set(CMAKE_CXX_EXTENSIONS OFF)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/third_party/cmake")
-option(WITH_GFLAGS "Use gflags to change command line flags." OFF)
-add_feature_info(GFLAGS WITH_GFLAGS
- "allows changing command line flags.")
-# glog option can only be turned on if gflags is on.
-cmake_dependent_option(WITH_GLOG "Use glog for logging." ON
- "WITH_GFLAGS" OFF)
-add_feature_info(GLOG WITH_GLOG "provides logging configurability.")
-
-option(BUILD_SHARED_LIBS "Build shared libraries instead of static." ON)
+option(BUILD_SHARED_LIBS "Build shared libraries instead of static." OFF)
add_feature_info(SHARED_LIBS BUILD_SHARED_LIBS
"builds shared libraries instead of static.")
@@ -37,26 +29,19 @@ option(BUILD_EXAMPLES "Build s2 documentation examples." ON)
feature_summary(WHAT ALL)
-if (WITH_GLOG)
- find_package(Glog REQUIRED)
- # FindGFlags.cmake and FindGlog.cmake do not seem to implement REQUIRED;
- # check manually.
- if (NOT ${GLOG_FOUND})
- message(FATAL_ERROR "Glog requested but not found")
- endif()
- add_definitions(-DS2_USE_GLOG)
-else()
- # Don't output anything for LOG(INFO).
- add_definitions(-DABSL_MIN_LOG_LEVEL=1)
+find_package(glog CONFIG REQUIRED)
+# FindGFlags.cmake and FindGlog.cmake do not seem to implement REQUIRED;
+# check manually.
+if (NOT ${GLOG_FOUND})
+ message(FATAL_ERROR "Glog requested but not found")
endif()
+add_definitions(-DS2_USE_GLOG)
-if (WITH_GFLAGS)
- find_package(GFlags REQUIRED)
- if (NOT ${GFLAGS_FOUND})
- message(FATAL_ERROR "GFlags requested but not found")
- endif()
- add_definitions(-DS2_USE_GFLAGS)
+find_package(gflags CONFIG REQUIRED)
+if (NOT ${GFLAGS_FOUND})
+ message(FATAL_ERROR "GFlags requested but not found")
endif()
+add_definitions(-DS2_USE_GFLAGS)
find_package(OpenSSL REQUIRED)
# pthreads isn't used directly, but this is still required for std::thread.
@@ -204,14 +189,18 @@ add_library(s2testing STATIC
src/s2/s2testing.cc)
target_link_libraries(
s2
- ${GFLAGS_LIBRARIES} ${GLOG_LIBRARIES} ${OPENSSL_LIBRARIES}
+ gflags::gflags glog::glog OpenSSL::SSL OpenSSL::Crypto
${CMAKE_THREAD_LIBS_INIT})
# Allow other CMake projects to use this one with:
# list(APPEND CMAKE_MODULE_PATH "<path_to_s2geometry_dir>/third_party/cmake")
# add_subdirectory(<path_to_s2geometry_dir> s2geometry)
# target_link_libraries(<target_name> s2)
-target_include_directories(s2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
+target_include_directories(s2 PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
+ $<INSTALL_INTERFACE:include>
+)
+
# We don't need to install all headers, only those
# transitively included by s2 headers we are exporting.
@@ -407,7 +396,18 @@ install(FILES src/s2/util/math/mathutil.h
install(FILES src/s2/util/units/length-units.h
src/s2/util/units/physical-units.h
DESTINATION include/s2/util/units)
-install(TARGETS s2 s2testing DESTINATION lib)
+ install(TARGETS s2 s2testing
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib)
+install(TARGETS s2
+ EXPORT unofficial-s2Targets
+ )
+install(EXPORT unofficial-s2Targets
+ NAMESPACE unofficial-s2
+ FILE unofficial-s2Targets.cmake
+ DESTINATION share/unofficial-s2/
+)
message("GTEST_ROOT: ${GTEST_ROOT}")
if (GTEST_ROOT)
@@ -534,3 +534,17 @@ endif()
if (${SWIG_FOUND} AND ${PYTHONLIBS_FOUND})
add_subdirectory("src/python" python)
endif()
+
+
+include(CMakePackageConfigHelpers)
+# generate the config file that is includes the exports
+configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
+ "${CMAKE_CURRENT_BINARY_DIR}/unofficial-s2Config.cmake"
+ INSTALL_DESTINATION "share/unofficial-s2/"
+ NO_SET_AND_CHECK_MACRO
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO
+ )
+ install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/unofficial-s2Config.cmake
+ DESTINATION "share/unofficial-s2/"
+ )