aboutsummaryrefslogtreecommitdiff
path: root/scripts/cmake
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2018-03-19 10:30:33 -0700
committerRobert Schumacher <roschuma@microsoft.com>2018-03-19 13:06:57 -0700
commit49a719b78a4c7feccc2aca970ec7fb242e1c121b (patch)
treeace57dc1d10b56ebca1245f0981abd9f8b6d3d9d /scripts/cmake
parent5968ebf9f4beae3a0662dfc6ba343b0be07a1241 (diff)
downloadvcpkg-49a719b78a4c7feccc2aca970ec7fb242e1c121b.tar.gz
vcpkg-49a719b78a4c7feccc2aca970ec7fb242e1c121b.zip
[libmysql] Use system dependencies to avoid ODR violations
Diffstat (limited to 'scripts/cmake')
-rw-r--r--scripts/cmake/vcpkg_build_cmake.cmake22
1 files changed, 16 insertions, 6 deletions
diff --git a/scripts/cmake/vcpkg_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake
index bdf192792..630662588 100644
--- a/scripts/cmake/vcpkg_build_cmake.cmake
+++ b/scripts/cmake/vcpkg_build_cmake.cmake
@@ -15,6 +15,9 @@
## The target passed to the cmake build command (`cmake --build . --target <target>`). If not specified, no target will
## be passed.
##
+## ### ADD_BIN_TO_PATH
+## Adds the appropriate Release and Debug `bin\` directories to the path during the build such that executables can run against the in-tree DLLs.
+##
## ## Notes:
## This command should be preceeded by a call to [`vcpkg_configure_cmake()`](vcpkg_configure_cmake.md).
## You can use the alias [`vcpkg_install_cmake()`](vcpkg_configure_cmake.md) function if your CMake script supports the
@@ -27,7 +30,7 @@
## * [poco](https://github.com/Microsoft/vcpkg/blob/master/ports/poco/portfile.cmake)
## * [opencv](https://github.com/Microsoft/vcpkg/blob/master/ports/opencv/portfile.cmake)
function(vcpkg_build_cmake)
- cmake_parse_arguments(_bc "DISABLE_PARALLEL" "TARGET;LOGFILE_ROOT" "" ${ARGN})
+ cmake_parse_arguments(_bc "DISABLE_PARALLEL;ADD_BIN_TO_PATH" "TARGET;LOGFILE_ROOT" "" ${ARGN})
if(NOT _bc_LOGFILE_ROOT)
set(_bc_LOGFILE_ROOT "build")
@@ -65,20 +68,24 @@ function(vcpkg_build_cmake)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL BUILDTYPE)
if(BUILDTYPE STREQUAL "debug")
set(SHORT_BUILDTYPE "dbg")
+ set(CONFIG "Debug")
else()
set(SHORT_BUILDTYPE "rel")
+ set(CONFIG "Release")
endif()
message(STATUS "Build ${TARGET_TRIPLET}-${SHORT_BUILDTYPE}")
set(LOGPREFIX "${CURRENT_BUILDTREES_DIR}/${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}-${SHORT_BUILDTYPE}")
set(LOGS)
- if(BUILDTYPE STREQUAL "release")
- set(CONFIG "Release")
- else()
- set(CONFIG "Debug")
+ if(_bc_ADD_BIN_TO_PATH)
+ set(_BACKUP_ENV_PATH "$ENV{PATH}")
+ if(BUILDTYPE STREQUAL "debug")
+ set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin;$ENV{PATH}")
+ else()
+ set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin;$ENV{PATH}")
+ endif()
endif()
-
execute_process(
COMMAND ${CMAKE_COMMAND} --build . --config ${CONFIG} ${TARGET_PARAM} -- ${BUILD_ARGS} ${PARALLEL_ARG}
OUTPUT_FILE "${LOGPREFIX}-out.log"
@@ -134,6 +141,9 @@ function(vcpkg_build_cmake)
endif()
endif()
message(STATUS "Build ${TARGET_TRIPLET}-${SHORT_BUILDTYPE} done")
+ if(_bc_ADD_BIN_TO_PATH)
+ set(ENV{PATH} "${_BACKUP_ENV_PATH}")
+ endif()
endif()
endforeach()
endfunction()