[CMake] The right way to link a library from multiple directories

Bill Hoffman bill.hoffman at kitware.com
Thu Jul 24 12:37:12 EDT 2008


Sebastian Krause wrote:
> Andreas Pakulat <apaku at gmx.de> wrote:
>> Thats not going to work on all platforms. There are various platforms
>> which don't allow static libs to be linked into shared libs.
>>
>> But it should be possible to gather the sources in the subdirs into a
>> variable that the parent cmake-file knows and pre-sets to empty. And
>> then also set the compile flags by using set_source_files_properties().
> 
> Yup, that's the other way I already tried. But that way had two
> problems:
> 
> - In Visual Studio all files were shown as if they would belong to
>   the same directory, the directory structure I have in the file
>   system is not represented in VS. Is there a way to manually define
>   how the file structure should be shown in IDEs?
Look at the source_groups command.
> - The whole project contains about 1000 files and MinGW fails on
>   linking. I still have to find out the exact error, but I was
>   suspecting that it might be because of the maximum length of the
>   parameters.
> 
The linking error should be fixed in 2.6.1.

-Bill


More information about the CMake mailing list