[vcpkg-build-msbuild] Add option to use vcpkg's integration. Fixes #891. Fixes #828.

This commit is contained in:
Robert Schumacher 2018-02-17 04:46:38 -08:00
parent 0170cdf5ab
commit d5e433f03b
7 changed files with 29 additions and 13 deletions

View File

@ -19,6 +19,11 @@ vcpkg_build_msbuild(
```
## 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.

View File

@ -28,8 +28,7 @@ vcpkg_build_msbuild(
PROJECT_PATH ${SOURCE_PATH}/MSVC_Net2013/atkmm.sln
TARGET atkmm
PLATFORM ${VS_PLATFORM}
# Need this for it to pick up xerces-c port: https://github.com/Microsoft/vcpkg/issues/891
OPTIONS /p:ForceImportBeforeCppTargets=${VCPKG_ROOT_DIR}/scripts/buildsystems/msbuild/vcpkg.targets
USE_VCPKG_INTEGRATION
)
# Handle headers

View File

@ -34,8 +34,7 @@ vcpkg_build_msbuild(
PROJECT_PATH ${SOURCE_PATH}/MSVC_Net2013/glibmm.sln
TARGET giomm
PLATFORM ${VS_PLATFORM}
# Need this for it to pick up xerces-c port: https://github.com/Microsoft/vcpkg/issues/891
OPTIONS /p:ForceImportBeforeCppTargets=${VCPKG_ROOT_DIR}/scripts/buildsystems/msbuild/vcpkg.targets
USE_VCPKG_INTEGRATION
)
# Handle headers

View File

@ -34,8 +34,7 @@ vcpkg_build_msbuild(
PROJECT_PATH ${SOURCE_PATH}/MSVC_Net2013/gtkmm.sln
TARGET gtkmm
PLATFORM ${VS_PLATFORM}
# Need this for it to pick up xerces-c port: https://github.com/Microsoft/vcpkg/issues/891
OPTIONS /p:ForceImportBeforeCppTargets=${VCPKG_ROOT_DIR}/scripts/buildsystems/msbuild/vcpkg.targets
USE_VCPKG_INTEGRATION
)
# Handle headers

View File

@ -34,8 +34,7 @@ vcpkg_build_msbuild(
PROJECT_PATH ${SOURCE_PATH}/MSVC_Net2013/pangomm.sln
TARGET pangomm
PLATFORM ${VS_PLATFORM}
# Need this for it to pick up xerces-c port: https://github.com/Microsoft/vcpkg/issues/891
OPTIONS /p:ForceImportBeforeCppTargets=${VCPKG_ROOT_DIR}/scripts/buildsystems/msbuild/vcpkg.targets
USE_VCPKG_INTEGRATION
)
# Handle headers

View File

@ -45,15 +45,15 @@ endif()
vcpkg_build_msbuild(
PROJECT_PATH ${SOURCE_PATH}/c/projects/Win32/VC10/AllInOne/AllInOne.vcxproj
PLATFORM ${BUILD_ARCH}
# Need this for it to pick up xerces-c port: https://github.com/Microsoft/vcpkg/issues/891
OPTIONS /p:ForceImportBeforeCppTargets=${VCPKG_ROOT_DIR}/scripts/buildsystems/msbuild/vcpkg.targets)
USE_VCPKG_INTEGRATION
)
# This is needed to generate the required LocalMsgIndex.hpp header
vcpkg_build_msbuild(
PROJECT_PATH ${SOURCE_PATH}/c/projects/Win32/VC10/Utils/XalanMsgLib/XalanMsgLib.vcxproj
PLATFORM ${BUILD_ARCH}
# Need this for it to pick up xerces-c port: https://github.com/Microsoft/vcpkg/issues/891
OPTIONS /p:ForceImportBeforeCppTargets=${VCPKG_ROOT_DIR}/scripts/buildsystems/msbuild/vcpkg.targets)
USE_VCPKG_INTEGRATION
)
file(COPY ${SOURCE_PATH}/c/Build/${OUTPUT_DIR}/VC10/Debug/XalanMessages_1_11D.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
file(COPY ${SOURCE_PATH}/c/Build/${OUTPUT_DIR}/VC10/Debug/Xalan-C_1_11D.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)

View File

@ -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)