This commit is contained in:
Robert Schumacher 2016-11-29 18:27:45 -08:00
commit 61e484a640
3 changed files with 42 additions and 13 deletions

View File

@ -37,8 +37,6 @@ message(STATUS "Adding worktree and patching done")
vcpkg_configure_cmake( vcpkg_configure_cmake(
SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src
OPTIONS
-DBUILD_SHARED_LIBS=ON
) )
vcpkg_install_cmake() vcpkg_install_cmake()
@ -55,4 +53,15 @@ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gtest_main.dll ${CURRENT_PACKAGES_
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gmock.dll ${CURRENT_PACKAGES_DIR}/debug/bin/gmock.dll) file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gmock.dll ${CURRENT_PACKAGES_DIR}/debug/bin/gmock.dll)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gmock_main.dll ${CURRENT_PACKAGES_DIR}/debug/bin/gmock_main.dll) file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gmock_main.dll ${CURRENT_PACKAGES_DIR}/debug/bin/gmock_main.dll)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib/manual-link)
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gtest.lib ${CURRENT_PACKAGES_DIR}/lib/manual-link/gtest.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gtest_main.lib ${CURRENT_PACKAGES_DIR}/lib/manual-link/gtest_main.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gmock.lib ${CURRENT_PACKAGES_DIR}/lib/manual-link/gmock.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gmock_main.lib ${CURRENT_PACKAGES_DIR}/lib/manual-link/gmock_main.lib)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gtest.lib ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/gtest.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gtest_main.lib ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/gtest_main.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gmock.lib ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/gmock.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gmock_main.lib ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/gmock_main.lib)
vcpkg_copy_pdbs() vcpkg_copy_pdbs()

View File

@ -31,11 +31,13 @@
<ItemDefinitionGroup Condition="'$(VcpkgEnabled)' == 'true'"> <ItemDefinitionGroup Condition="'$(VcpkgEnabled)' == 'true'">
<Link> <Link>
<AdditionalDependencies Condition="'$(VcpkgConfiguration)' == 'Debug'">$(VcpkgRoot)debug\lib\*.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies Condition="'$(VcpkgConfiguration)' == 'Debug' and '$(VcpkgAutoLink)' != 'false'">%(AdditionalDependencies);$(VcpkgRoot)debug\lib\*.lib</AdditionalDependencies>
<AdditionalDependencies Condition="'$(VcpkgConfiguration)' == 'Release'">$(VcpkgRoot)lib\*.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies Condition="'$(VcpkgConfiguration)' == 'Release' and '$(VcpkgAutoLink)' != 'false'">%(AdditionalDependencies);$(VcpkgRoot)lib\*.lib</AdditionalDependencies>
<AdditionalLibraryDirectories Condition="'$(VcpkgConfiguration)' == 'Release'">%(AdditionalLibraryDirectories);$(VcpkgRoot)lib;$(VcpkgRoot)lib\manual-link</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories Condition="'$(VcpkgConfiguration)' == 'Debug'">%(AdditionalLibraryDirectories);$(VcpkgRoot)debug\lib;$(VcpkgRoot)debug\lib\manual-link</AdditionalLibraryDirectories>
</Link> </Link>
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>$(VcpkgRoot)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(VcpkgRoot)include</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>

View File

@ -46,21 +46,29 @@ if(NOT VCPKG_TOOLCHAIN)
list(APPEND CMAKE_PREFIX_PATH list(APPEND CMAKE_PREFIX_PATH
${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug
) )
list(APPEND CMAKE_LIBRARY_PATH
${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/manual-link
)
link_directories(${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/manual-link)
endif() endif()
list(APPEND CMAKE_PREFIX_PATH list(APPEND CMAKE_PREFIX_PATH
${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}
) )
list(APPEND CMAKE_LIBRARY_PATH
${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/manual-link
)
link_directories(${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/manual-link)
include_directories(${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include) include_directories(${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include)
set(CMAKE_PROGRAM_PATH ${CMAKE_PROGRAM_PATH} ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools) set(CMAKE_PROGRAM_PATH ${CMAKE_PROGRAM_PATH} ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools)
option(OVERRIDE_ADD_EXECUTABLE "Automatically copy dependencies into the output directory for executables." ON) option(VCPKG_APPLOCAL_DEPS "Automatically copy dependencies into the output directory for executables." ON)
if(OVERRIDE_ADD_EXECUTABLE) function(add_executable name)
function(add_executable name) _add_executable(${ARGV})
_add_executable(${ARGV}) list(FIND ARGV "IMPORTED" IMPORTED_IDX)
list(FIND ARGV "IMPORTED" IMPORTED_IDX) if(IMPORTED_IDX EQUAL -1)
if(IMPORTED_IDX EQUAL -1) if(VCPKG_APPLOCAL_DEPS)
add_custom_command(TARGET ${name} POST_BUILD add_custom_command(TARGET ${name} POST_BUILD
COMMAND powershell -noprofile -executionpolicy UnRestricted -file ${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1 COMMAND powershell -noprofile -executionpolicy UnRestricted -file ${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1
-targetBinary $<TARGET_FILE:${name}> -targetBinary $<TARGET_FILE:${name}>
@ -68,7 +76,17 @@ if(NOT VCPKG_TOOLCHAIN)
-OutVariable out -OutVariable out
) )
endif() endif()
endfunction() set_target_properties(${name} PROPERTIES VS_GLOBAL_VcpkgEnabled false)
endif() endif()
endfunction()
function(add_library name)
_add_library(${ARGV})
list(FIND ARGV "IMPORTED" IMPORTED_IDX)
if(IMPORTED_IDX EQUAL -1)
set_target_properties(${name} PROPERTIES VS_GLOBAL_VcpkgEnabled false)
endif()
endfunction()
set(VCPKG_TOOLCHAIN ON) set(VCPKG_TOOLCHAIN ON)
endif() endif()