2017-05-25 14:33:16 +08:00
## # vcpkg_install_cmake
##
## Build and install a cmake project.
##
## ## Usage:
## ```cmake
## vcpkg_install_cmake([MSVC_64_TOOLSET])
## ```
##
## ## Parameters:
## ### MSVC_64_TOOLSET
## This adds the `/p:PreferredToolArchitecture=x64` switch if the underlying buildsystem is MSBuild. Some large projects can run out of memory when linking if they use the 32-bit hosted tools.
##
## ## Notes:
## This command should be preceeded by a call to [`vcpkg_configure_cmake()`](vcpkg_configure_cmake.md).
##
## ## Examples:
##
## * [zlib](https://github.com/Microsoft/vcpkg/blob/master/ports/zlib/portfile.cmake)
## * [cpprestsdk](https://github.com/Microsoft/vcpkg/blob/master/ports/cpprestsdk/portfile.cmake)
## * [poco](https://github.com/Microsoft/vcpkg/blob/master/ports/poco/portfile.cmake)
## * [opencv](https://github.com/Microsoft/vcpkg/blob/master/ports/opencv/portfile.cmake)
2016-09-19 11:50:08 +08:00
function ( vcpkg_install_cmake )
2017-01-14 11:09:42 +08:00
cmake_parse_arguments ( _bc "MSVC_64_TOOLSET;DISABLE_PARALLEL" "" "" ${ ARGN } )
2017-02-09 07:24:59 +08:00
set ( MSVC_EXTRA_ARGS
" / p : V C P k g L o c a l A p p D a t a D i s a b l e d = t r u e "
" / p : U s e I n t e l M K L = N o "
)
2017-01-14 11:09:42 +08:00
# Specifies the architecture of the toolset, NOT the architecture of the produced binary
2017-02-09 07:24:59 +08:00
# This can help libraries that cause the linker to run out of memory.
# https://support.microsoft.com/en-us/help/2891057/linker-fatal-error-lnk1102-out-of-memory
2017-01-14 11:09:42 +08:00
if ( _bc_MSVC_64_TOOLSET )
list ( APPEND MSVC_EXTRA_ARGS "/p:PreferredToolArchitecture=x64" )
endif ( )
if ( NOT _bc_DISABLE_PARALLEL )
list ( APPEND MSVC_EXTRA_ARGS "/m" )
endif ( )
2017-02-04 00:16:13 +08:00
if ( EXISTS ${ CURRENT_BUILDTREES_DIR } / ${ TARGET_TRIPLET } -rel/build.ninja )
set ( BUILD_ARGS -v ) # verbose output
else ( )
set ( BUILD_ARGS ${ MSVC_EXTRA_ARGS } )
endif ( )
2017-01-14 11:09:42 +08:00
2016-09-19 11:50:08 +08:00
message ( STATUS "Package ${TARGET_TRIPLET}-rel" )
vcpkg_execute_required_process (
2017-02-04 00:16:13 +08:00
C O M M A N D $ { C M A K E _ C O M M A N D } - - b u i l d . - - c o n f i g R e l e a s e - - t a r g e t i n s t a l l - - $ { B U I L D _ A R G S }
2016-09-19 11:50:08 +08:00
W O R K I N G _ D I R E C T O R Y $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - r e l
L O G N A M E p a c k a g e - $ { T A R G E T _ T R I P L E T } - r e l
)
message ( STATUS "Package ${TARGET_TRIPLET}-rel done" )
message ( STATUS "Package ${TARGET_TRIPLET}-dbg" )
vcpkg_execute_required_process (
2017-02-04 00:16:13 +08:00
C O M M A N D $ { C M A K E _ C O M M A N D } - - b u i l d . - - c o n f i g D e b u g - - t a r g e t i n s t a l l - - $ { B U I L D _ A R G S }
2016-09-19 11:50:08 +08:00
W O R K I N G _ D I R E C T O R Y $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - d b g
L O G N A M E p a c k a g e - $ { T A R G E T _ T R I P L E T } - d b g
)
message ( STATUS "Package ${TARGET_TRIPLET}-dbg done" )
endfunction ( )