@@ -238,6 +238,13 @@ def PositiveInt(string):
238238 help = "Print the corresponding CMake command and quit"
239239)
240240
241+ parser .add_argument (
242+ '--vcpkg' ,
243+ nargs = '?' ,
244+ const = '{}/scripts/buildsystems/vcpkg.cmake' .format (os .environ ['VCPKG_ROOT' ]),
245+ help = 'Enables vcpkg using $VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake or given argument'
246+ )
247+
241248args = parser .parse_args ()
242249
243250polly_toolchain = detail .toolchain_name .get (args .toolchain )
@@ -296,7 +303,6 @@ def PositiveInt(string):
296303toolchain_path = os .path .join (polly_root , "{}.cmake" .format (polly_toolchain ))
297304if not os .path .exists (toolchain_path ):
298305 sys .exit ("Toolchain file not found: {}" .format (toolchain_path ))
299- toolchain_option = "-DCMAKE_TOOLCHAIN_FILE={}" .format (toolchain_path )
300306
301307if args .output :
302308 if not os .path .isdir (args .output ):
@@ -309,7 +315,6 @@ def PositiveInt(string):
309315
310316build_dir = os .path .join (cdir , '_builds' , build_tag )
311317print ("Build dir: {}" .format (build_dir ))
312- build_dir_option = "-B{}" .format (build_dir )
313318
314319install_dir = os .path .join (cdir , '_install' , polly_toolchain )
315320local_install = args .install or args .strip or args .framework or args .framework_device or args .archive
@@ -380,9 +385,13 @@ def PositiveInt(string):
380385generate_command = [
381386 cmake_bin ,
382387 '-H{}' .format (home ),
383- build_dir_option
388+ '-B{}' .format (build_dir ),
389+ '-DCMAKE_TOOLCHAIN_FILE={}' .format (args .vcpkg if args .vcpkg else toolchain_path )
384390]
385391
392+ if args .vcpkg :
393+ generate_command .append ('-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE={}' .format (toolchain_path ))
394+
386395if args .cache :
387396 if not os .path .isfile (args .cache ):
388397 sys .exit ("Specified cache file does not exist: {}" .format (args .cache ))
@@ -403,9 +412,6 @@ def PositiveInt(string):
403412 toolset = 'v{}0_xp' .format (toolchain_entry .vs_version )
404413 generate_command .append ('-T{}' .format (toolset ))
405414
406- if toolchain_option :
407- generate_command .append (toolchain_option )
408-
409415if args .verbosity == 'full' :
410416 generate_command .append ('-DCMAKE_VERBOSE_MAKEFILE=ON' )
411417 generate_command .append ('-DPOLLY_STATUS_DEBUG=ON' )
0 commit comments