diff --git a/docs/maintainers/vcpkg_build_msbuild.md b/docs/maintainers/vcpkg_build_msbuild.md index 889b07bdc..37f8d8df2 100644 --- a/docs/maintainers/vcpkg_build_msbuild.md +++ b/docs/maintainers/vcpkg_build_msbuild.md @@ -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. diff --git a/ports/atkmm/portfile.cmake b/ports/atkmm/portfile.cmake index 4cbaee7ad..74cf021c8 100644 --- a/ports/atkmm/portfile.cmake +++ b/ports/atkmm/portfile.cmake @@ -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 diff --git a/ports/glibmm/portfile.cmake b/ports/glibmm/portfile.cmake index fd4853f55..7586c40a3 100644 --- a/ports/glibmm/portfile.cmake +++ b/ports/glibmm/portfile.cmake @@ -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 diff --git a/ports/gtkmm/portfile.cmake b/ports/gtkmm/portfile.cmake index c82bc597d..707e64a9b 100644 --- a/ports/gtkmm/portfile.cmake +++ b/ports/gtkmm/portfile.cmake @@ -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 diff --git a/ports/pangomm/portfile.cmake b/ports/pangomm/portfile.cmake index ad350f638..e3409fe15 100644 --- a/ports/pangomm/portfile.cmake +++ b/ports/pangomm/portfile.cmake @@ -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 diff --git a/ports/xalan-c/portfile.cmake b/ports/xalan-c/portfile.cmake index 55dd9f143..4f4da9143 100644 --- a/ports/xalan-c/portfile.cmake +++ b/ports/xalan-c/portfile.cmake @@ -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) 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)