[CMake] Reading lists of items from an external file (fwd)

Hinderk Buss hinderk at sigma-c.de
Mon Oct 11 15:09:54 EDT 2004



---------- Forwarded message ----------
Date: Mon, 11 Oct 2004 20:52:49 +0200 (CEST)
From: Hinderk Buss <hinderk at sigma-c.de>
To: CMake Mailing List <cmake at www.cmake.org>
Subject: Reading lists of items from an external file


Dear readers of this list,

I would like to store information about those libraries against which I 
want to link my target in a seperate file. This file should simply contain 
a number of filenames or names of other targets already build:

explBasic
explMath
explElement
3rd_party/lib/libxerces-c_1_6_0.so

...

I tried to imort this information with the following directive:

FILE( READ libraries.txt LINKLIBRARIES )

The variable LINKLIBRARIES thus created contains all the newlines and the 
whitespace present in the file "libraries.txt". Still I cannot use the
information in the following manner 

TARGET_LINK_LIBRARIES( ${TARGET} ${LINKLIBRARIES} )

as the content of the file is treated as *one* string/name including all 
the whitespace and the newlines. The generated makefiles are syntactically 
incorrect and won't run under the Linux operating system. I tried the 
directive 

SEPARATE_ARGUMENTS( LINKLIBRARIES )
 
in the hope of breaking down the input in several tokens to be 
processed individually. Unfortunately, this didn't help me at all. I suppose 
I keep making stupid mistakes. Can anyone help me on this? 

Thanks in advance, Hinderk Buss

P.S.: I forgot to mention, that I have already tried rearranging the file:
      I used only one line, seperated the names with ";", escaped the 
      newlines... etc.


More information about the CMake mailing list