Last active
February 6, 2019 11:06
-
-
Save stefan-pdx/9572d5c5aec284e3cadb1f1909f70470 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
namespace 'conan' do | |
desc 'Export Conan binary directories to the CONAN_BINARY_DIRECTORIES environment variable' | |
task :export_env do | |
doc = File.open('conanbuildinfo.props') { |f| Nokogiri::XML(f) } | |
paths = doc.search("ConanBinaryDirectories").first.text | |
`setx.exe CONAN_BINARY_DIRECTORIES "#{paths}"` | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This Rakefile can be used to parse through the Visual Studio property sheet generated by Conan (
conanbuildinfo.props
) and extract out the directory paths containing any binaries (i.e., .dlls) and set theCONAN_BINARY_DIRECTORIES
environmental variable. This allows a Visual Studio project to link with runtime dependencies which is useful for running tests.To use it, simply place this file in your project folder, install Nokogiri (
gem install nokogiri
), and runrake conan:export_env
. Cheers!