mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 10:21:07 +08:00
108 lines
3.8 KiB
Diff
108 lines
3.8 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index f080b4b..ba80cbc 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -26,16 +26,7 @@ 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.")
|
|
|
|
@@ -46,26 +37,19 @@ add_feature_info(PYTHON WITH_PYTHON "provides python interface to S2")
|
|
|
|
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(absl REQUIRED)
|
|
find_package(OpenSSL REQUIRED)
|
|
@@ -101,7 +85,7 @@ endif()
|
|
# something like:
|
|
# OPENSSL_ROOT_DIR=/usr/local/opt/openssl cmake ..
|
|
include_directories(
|
|
- ${GFLAGS_INCLUDE_DIRS} ${GLOG_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR})
|
|
+ gflags::gflags glog::glog OpenSSL::SSL OpenSSL::Crypto)
|
|
|
|
if (WITH_PYTHON)
|
|
include_directories(${Python3_INCLUDE_DIRS})
|
|
@@ -253,7 +237,10 @@ endif()
|
|
# 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>
|
|
+)
|
|
|
|
# Add version information to the target
|
|
set_target_properties(s2 PROPERTIES
|
|
@@ -427,6 +414,12 @@ install(TARGETS ${S2_TARGETS}
|
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
|
+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)
|
|
@@ -569,3 +562,13 @@ endif()
|
|
if (${SWIG_FOUND} AND ${Python3_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/")
|