aboutsummaryrefslogtreecommitdiff
path: root/scripts/cmake/vcpkg_build_msbuild.cmake
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2018-02-17 04:46:38 -0800
committerRobert Schumacher <roschuma@microsoft.com>2018-03-20 21:49:53 -0700
commitd5e433f03bf5220ef075489c18f5d1522fda1a4d (patch)
tree6c2d2d5dd8877ec68e5f90570037d0feee4399d6 /scripts/cmake/vcpkg_build_msbuild.cmake
parent0170cdf5abc7719e7819613dfa2263510efd45c3 (diff)
downloadvcpkg-d5e433f03bf5220ef075489c18f5d1522fda1a4d.tar.gz
vcpkg-d5e433f03bf5220ef075489c18f5d1522fda1a4d.zip
[vcpkg-build-msbuild] Add option to use vcpkg's integration. Fixes #891. Fixes #828.
Diffstat (limited to 'scripts/cmake/vcpkg_build_msbuild.cmake')
-rw-r--r--scripts/cmake/vcpkg_build_msbuild.cmake17
1 files changed, 16 insertions, 1 deletions
diff --git a/scripts/cmake/vcpkg_build_msbuild.cmake b/scripts/cmake/vcpkg_build_msbuild.cmake
index 6da8a7369..db04530ef 100644
--- a/scripts/cmake/vcpkg_build_msbuild.cmake
+++ b/scripts/cmake/vcpkg_build_msbuild.cmake
@@ -19,6 +19,11 @@
## ```
##
## ## Parameters
+## ### USE_VCPKG_INTEGRATION
+## Apply the normal `integrate install` integration for building the project.
+##
+## By default, projects built with this command will not automatically link libraries or have header paths set.
+##
## ### PROJECT_PATH
## The path to the solution (`.sln`) or project (`.vcxproj`) file.
##
@@ -56,7 +61,13 @@
## * [cppunit](https://github.com/Microsoft/vcpkg/blob/master/ports/cppunit/portfile.cmake)
function(vcpkg_build_msbuild)
- cmake_parse_arguments(_csc "" "PROJECT_PATH;RELEASE_CONFIGURATION;DEBUG_CONFIGURATION;PLATFORM;PLATFORM_TOOLSET;TARGET_PLATFORM_VERSION;TARGET" "OPTIONS;OPTIONS_RELEASE;OPTIONS_DEBUG" ${ARGN})
+ cmake_parse_arguments(
+ _csc
+ "USE_VCPKG_INTEGRATION"
+ "PROJECT_PATH;RELEASE_CONFIGURATION;DEBUG_CONFIGURATION;PLATFORM;PLATFORM_TOOLSET;TARGET_PLATFORM_VERSION;TARGET"
+ "OPTIONS;OPTIONS_RELEASE;OPTIONS_DEBUG"
+ ${ARGN}
+ )
if(NOT DEFINED _csc_RELEASE_CONFIGURATION)
set(_csc_RELEASE_CONFIGURATION Release)
@@ -93,6 +104,10 @@ function(vcpkg_build_msbuild)
list(APPEND _csc_OPTIONS /p:WholeProgramOptimization=false)
endif()
+ if(_csc_USE_VCPKG_INTEGRATION)
+ list(APPEND _csc_OPTIONS /p:ForceImportBeforeCppTargets=${VCPKG_ROOT_DIR}/scripts/buildsystems/msbuild/vcpkg.targets)
+ endif()
+
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
message(STATUS "Building ${_csc_PROJECT_PATH} for Release")
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)