[ceres] Don't force C++14 on downstream customers. (#22983)

Resolves https://github.com/microsoft/vcpkg/issues/22980

https://github.com/microsoft/vcpkg/pull/12785 Added a set of `CMAKE_CXX_STANDARD` in this CMake config which accidentally overwrites higher versions. Upstream already has a `target_compile_options` to do this the Right Way.

This change:
* Deletes the offending attempt to set CMAKE_CXX_STANDARD. Downstream users that don't listen to the INTERFACE_COMPILE_FEATURES need to be patched locally.
* Modernizes to use vcpkg_cmake_Xxx.
* Removes attempt to fix up paths that already appears handled by `vcpkg_cmake_config_fixup`.
* Adds quotes.
This commit is contained in:
Billy O'Neal 2022-02-08 22:43:23 -08:00 committed by GitHub
parent 22dd6ab207
commit 122bdbcec6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 37 deletions

View File

@ -1,7 +1,7 @@
set(MSVC_USE_STATIC_CRT_VALUE OFF)
if(VCPKG_CRT_LINKAGE STREQUAL "static")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
message(FATAL_ERROR "Ceres does not currently support mixing static CRT and dynamic library linkage")
message(FATAL_ERROR "Ceres does not support mixing static CRT and dynamic library linkage")
endif()
set(MSVC_USE_STATIC_CRT_VALUE ON)
endif()
@ -20,11 +20,11 @@ vcpkg_from_github(
find-package-required.patch
)
file(REMOVE ${SOURCE_PATH}/cmake/FindCXSparse.cmake)
file(REMOVE ${SOURCE_PATH}/cmake/FindGflags.cmake)
file(REMOVE ${SOURCE_PATH}/cmake/FindGlog.cmake)
file(REMOVE ${SOURCE_PATH}/cmake/FindEigen.cmake)
file(REMOVE ${SOURCE_PATH}/cmake/FindSuiteSparse.cmake)
file(REMOVE "${SOURCE_PATH}/cmake/FindCXSparse.cmake")
file(REMOVE "${SOURCE_PATH}/cmake/FindGflags.cmake")
file(REMOVE "${SOURCE_PATH}/cmake/FindGlog.cmake")
file(REMOVE "${SOURCE_PATH}/cmake/FindEigen.cmake")
file(REMOVE "${SOURCE_PATH}/cmake/FindSuiteSparse.cmake")
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
@ -35,9 +35,8 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
"tools" GFLAGS
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DEXPORT_BUILD_DIR=ON
@ -50,37 +49,17 @@ vcpkg_configure_cmake(
-DLIB_SUFFIX=${LIB_SUFFIX}
)
vcpkg_install_cmake()
vcpkg_cmake_install()
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_fixup_cmake_targets(CONFIG_PATH CMake)
vcpkg_cmake_config_fixup(CONFIG_PATH CMake)
else()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib${LIB_SUFFIX}/cmake/Ceres)
vcpkg_cmake_config_fixup(CONFIG_PATH "lib${LIB_SUFFIX}/cmake/Ceres")
endif()
file(READ ${CURRENT_PACKAGES_DIR}/share/ceres/CeresConfig.cmake CERES_CONFIG)
string(REPLACE "set_target_properties(ceres PROPERTIES INTERFACE_LINK_LIBRARIES Ceres::ceres)"
"set_target_properties(ceres PROPERTIES INTERFACE_LINK_LIBRARIES Ceres::ceres)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)" CERES_CONFIG "${CERES_CONFIG}")
file(WRITE ${CURRENT_PACKAGES_DIR}/share/ceres/CeresConfig.cmake "${CERES_CONFIG}")
vcpkg_copy_pdbs()
# Changes target search path
if(VCPKG_TARGET_IS_WINDOWS)
file(READ ${CURRENT_PACKAGES_DIR}/share/ceres/CeresConfig.cmake CERES_TARGETS)
string(REPLACE "get_filename_component(CURRENT_ROOT_INSTALL_DIR\n \${CERES_CURRENT_CONFIG_DIR}/../"
"get_filename_component(CURRENT_ROOT_INSTALL_DIR\n \${CERES_CURRENT_CONFIG_DIR}/../../" CERES_TARGETS "${CERES_TARGETS}")
file(WRITE ${CURRENT_PACKAGES_DIR}/share/ceres/CeresConfig.cmake "${CERES_TARGETS}")
else()
file(READ ${CURRENT_PACKAGES_DIR}/share/ceres/CeresConfig.cmake CERES_TARGETS)
string(REPLACE "get_filename_component(CURRENT_ROOT_INSTALL_DIR\n \${CERES_CURRENT_CONFIG_DIR}/../../../"
"get_filename_component(CURRENT_ROOT_INSTALL_DIR\n \${CERES_CURRENT_CONFIG_DIR}/../../" CERES_TARGETS "${CERES_TARGETS}")
file(WRITE ${CURRENT_PACKAGES_DIR}/share/ceres/CeresConfig.cmake "${CERES_TARGETS}")
endif()
# Clean
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

View File

@ -1,12 +1,20 @@
{
"name": "ceres",
"version-semver": "2.0.0",
"port-version": 5,
"port-version": 6,
"description": "non-linear optimization package",
"homepage": "https://github.com/ceres-solver/ceres-solver",
"dependencies": [
"eigen3",
"glog"
"glog",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"cxsparse": {

View File

@ -1290,7 +1290,7 @@
},
"ceres": {
"baseline": "2.0.0",
"port-version": 5
"port-version": 6
},
"cfitsio": {
"baseline": "3.49",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "af54888fc010404793ba51c862147575c09a988b",
"version-semver": "2.0.0",
"port-version": 6
},
{
"git-tree": "07f2aa6906e97637ae7a4ed6dcfce6867eb1a049",
"version-semver": "2.0.0",