[vcpkg-fixup-cmake-targets] Add TARGET_PATH option

This commit is contained in:
Robert Schumacher 2018-01-03 20:11:35 -08:00
parent 753a19c618
commit 0cf5bd657e
2 changed files with 15 additions and 11 deletions

View File

@ -38,17 +38,13 @@ function(vcpkg_build_cmake)
if(_VCPKG_CMAKE_GENERATOR MATCHES "Ninja")
set(BUILD_ARGS "-v") # verbose output
if (_bc_DISABLE_PARALLEL)
set(NO_PARALLEL_ARG "-j1")
endif()
set(NO_PARALLEL_ARG "-j1")
elseif(_VCPKG_CMAKE_GENERATOR MATCHES "Visual Studio")
set(BUILD_ARGS
"/p:VCPkgLocalAppDataDisabled=true"
"/p:UseIntelMKL=No"
)
if (NOT _bc_DISABLE_PARALLEL)
set(PARALLEL_ARG "/m")
endif()
set(PARALLEL_ARG "/m")
elseif(_VCPKG_CMAKE_GENERATOR MATCHES "NMake")
# No options are currently added for nmake builds
else()
@ -61,6 +57,10 @@ function(vcpkg_build_cmake)
set(TARGET_PARAM)
endif()
if(_bc_DISABLE_PARALLEL)
set(PARALLEL_ARG ${NO_PARALLEL_ARG})
endif()
foreach(BUILDTYPE "release" "debug")
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL BUILDTYPE)
if(BUILDTYPE STREQUAL "debug")

View File

@ -14,14 +14,18 @@
#
function(vcpkg_fixup_cmake_targets)
cmake_parse_arguments(_vfct "" "CONFIG_PATH" "" ${ARGN})
cmake_parse_arguments(_vfct "" "CONFIG_PATH;TARGET_PATH" "" ${ARGN})
if(_vfct_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "vcpkg_fixup_cmake_targets was passed extra arguments: ${_vfct_UNPARSED_ARGUMENTS}")
endif()
set(DEBUG_SHARE ${CURRENT_PACKAGES_DIR}/debug/share/${PORT})
set(RELEASE_SHARE ${CURRENT_PACKAGES_DIR}/share/${PORT})
if(NOT _vfct_TARGET_PATH)
set(_vfct_TARGET_PATH share/${PORT})
endif()
set(DEBUG_SHARE ${CURRENT_PACKAGES_DIR}/debug/${_vfct_TARGET_PATH})
set(RELEASE_SHARE ${CURRENT_PACKAGES_DIR}/${_vfct_TARGET_PATH})
if(_vfct_CONFIG_PATH AND NOT RELEASE_SHARE STREQUAL "${CURRENT_PACKAGES_DIR}/${_vfct_CONFIG_PATH}")
set(DEBUG_CONFIG ${CURRENT_PACKAGES_DIR}/debug/${_vfct_CONFIG_PATH})
@ -114,7 +118,7 @@ function(vcpkg_fixup_cmake_targets)
string(REGEX REPLACE "\\\${_IMPORT_PREFIX}/bin/([^ \"]+\\.exe)" "\${_IMPORT_PREFIX}/tools/${PORT}/\\1" _contents "${_contents}")
string(REPLACE "\${_IMPORT_PREFIX}/lib" "\${_IMPORT_PREFIX}/debug/lib" _contents "${_contents}")
string(REPLACE "\${_IMPORT_PREFIX}/bin" "\${_IMPORT_PREFIX}/debug/bin" _contents "${_contents}")
file(WRITE ${CURRENT_PACKAGES_DIR}/share/${PORT}/${DEBUG_TARGET_NAME} "${_contents}")
file(WRITE ${CURRENT_PACKAGES_DIR}/${_vfct_TARGET_PATH}/${DEBUG_TARGET_NAME} "${_contents}")
file(REMOVE ${DEBUG_TARGET})
endforeach()
@ -148,7 +152,7 @@ function(vcpkg_fixup_cmake_targets)
file(WRITE ${MAIN_CONFIG} "${_contents}")
endforeach()
# Remove /debug/share/<port>/ if it's empty.
# Remove /debug/<target_path>/ if it's empty.
file(GLOB_RECURSE REMAINING_FILES "${DEBUG_SHARE}/*")
if(NOT REMAINING_FILES)
file(REMOVE_RECURSE ${DEBUG_SHARE})