2011-09-13 43 views
0

我正在將我的頭文件「安裝」到主要包含目錄,以便所有額外的scons構建可以訪問它們。分層頭安裝Scons

headers = ''' this.h that.h other.h dir1/other.h dir2/other.h'''.split() 
include_path = Dir('cppunit', local_env['incinstall']) 
hdr_inst = local_env.Install(include_path, headers) 
env.Alias('install_cppunittest_headers', hdr_inst) 

使用SCons似乎打平我的頭佈局,然後崩潰,因爲有多個other.h的

Install file: "tools\CppUnitTest\src\cppunit\TestRunner.h" as "include\cppunit\TestRunner.h" 
scons: *** [include\cppunit\TestRunner.h] AssertionError : Installing source ['tools\\CppUnitTest\\src\\cppunit\\TestRunner.h', 'tools\\CppUnitTest\\src\\cppunit\\ui\\text\\TestRunner.h'] into target ['include\\cppunit\\TestRunner.h']: target and source lists must have same length. 

沒有人有他們的文件夾層次結構中安裝我的頭配方保留嗎?

回答

0

試試這個:

headers = ''' this.h that.h other.h dir1/other.h dir2/other.h'''.split() 
include_path = Dir('cppunit', local_env['incinstall']) 
hdr_inst = [local_env.Install(include_path+'/'+h, h) for h in headers] 
env.Alias('install_cppunittest_headers', hdr_inst) 
+0

有沒有辦法用內置的水珠()函數來做到這一點?或者基本上不必手動指定標題? –

+0

絕對可以使用Glob()。但是,最好的做法是明確列出來源,以避免意外地包含您不想要的文件。 – bdbaddog