vcpkg_cmake_get_vars
Runs a cmake configure with a dummy project to extract certain cmake variables
Usage
vcpkg_cmake_get_vars(<out-var>)
vcpkg_cmake_get_vars(<out-var>)
sets <out-var>
to
a path to a generated CMake file, with the detected CMAKE_*
variables
re-exported as VCPKG_DETECTED_CMAKE_*
.
Additionally sets, for RELEASE
and DEBUG
:
VCPKG_COMBINED_CXX_FLAGS_<config>
VCPKG_COMBINED_C_FLAGS_<config>
VCPKG_COMBINED_SHARED_LINKER_FLAGS_<config>
VCPKG_COMBINED_STATIC_LINKER_FLAGS_<config>
VCPKG_COMBINED_EXE_LINKER_FLAGS_<config>
Most users should use these pre-combined flags instead of attempting
to read the VCPKG_DETECTED_*
flags directly.
Notes
Avoid usage in portfiles.
All calls to vcpkg_cmake_get_vars
will result in the same output file;
the output file is not generated multiple times.
Basic Usage
vcpkg_cmake_get_vars(cmake_vars_file)
include("${cmake_vars_file}")
message(STATUS "detected CXX flags: ${VCPKG_DETECTED_CMAKE_CXX_FLAGS}")
Source
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for