Description of problem
The portfile for Ceres contains the following logic:
|
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}") |
This can create issues for users who import Ceres into their projects using find_package(Ceres), because this unconditionally and globally overwrites the CMAKE_CXX_STANDARD variable to the value 14. As a result, consumers who wish to use a different C++ standard are forced to manually (re)set this variable after including Ceres.
This behavior appears to have been introduced here, as part of #12785.
Proposed solution
Modify the Ceres portfile to stop injecting these lines. vcpkg should not modify the user's CMAKE_CXX_STANDARD variable. Provided there is agreement, I am happy to submit such a PR.
Note that the upstream Ceres project already enforces a minimum C++ standard using a more idiomatic and targeted CMake mechanism.
Describe alternatives you've considered
I am currently able to work around this issue by manually resetting CMAKE_CXX_STANDARD after including Ceres:
set(orig_cxx_std ${CMAKE_CXX_STANDARD})
find_package(Ceres REQUIRED)
set(CMAKE_CXX_STANDARD ${orig_cxx_std})
Additional context
This behavior appears to have been introduced by #12785. cc @cenit, @JackBoosY, @BillyONeal
Description of problem
The portfile for Ceres contains the following logic:
vcpkg/ports/ceres/portfile.cmake
Lines 60 to 65 in 7e7dad5
This can create issues for users who import Ceres into their projects using
find_package(Ceres), because this unconditionally and globally overwrites the CMAKE_CXX_STANDARD variable to the value14. As a result, consumers who wish to use a different C++ standard are forced to manually (re)set this variable after including Ceres.This behavior appears to have been introduced here, as part of #12785.
Proposed solution
Modify the Ceres portfile to stop injecting these lines. vcpkg should not modify the user's CMAKE_CXX_STANDARD variable. Provided there is agreement, I am happy to submit such a PR.
Note that the upstream Ceres project already enforces a minimum C++ standard using a more idiomatic and targeted CMake mechanism.
Describe alternatives you've considered
I am currently able to work around this issue by manually resetting CMAKE_CXX_STANDARD after including Ceres:
Additional context
This behavior appears to have been introduced by #12785. cc @cenit, @JackBoosY, @BillyONeal