[CMake] CMake Error: Cannot determine link language for target "io".

Mats Kindahl mats at sun.com
Tue May 19 10:50:37 EDT 2009



Hendrik Sattler wrote:
> Zitat von Mats Kindahl <mats at sun.com>:
>> Hendrik Sattler wrote:
>>> Zitat von Mats Kindahl <mats at Sun.COM>:
>>>> I have an example case where I want to decide the subsystems to include
>>>> dynamically. However, when running CMake, I get the error above.
>>>>
>>>> Anybody can tell me why I get the error and what to do about it?
>>>
>>> You could give your files a file ending like 'output.c' instead of just
>>> 'output'. Or, if that is the normal file naming, set the LANGUAGE file
>>> property and the LINKER_LANGUAGE target property.
>>
>> OK. Adding suffixes to the files did help, but IIRC, the manual said
>>  that CMake
>> figures this out itself.
> 
> It does but it needs hints like file suffixes to do so. Either automatic
> with file ending or manually.
> 
>>> You have an additional problem: you use target 'io' before it is
>>> defined. If the io library is not installed, yet, this will fail.
>>
>> Actually, in the first version (looking a little different, but 
>> having the same dependency) made CMake resolve the dependency itself.
>>
>> Ideally, I would like to copy or build the libraries in a central "lib/"
>> directory similar to how I copy all the include files to the "include/"
>> directory, but how is that supported by CMake?
> 
> See
> http://www.cmake.org/cmake/help/cmake2.6docs.html#variable:CMAKE_LIBRARY_OUTPUT_DIRECTORY
> 
> 
> Or you use the INSTALL() directives to add the install target that you
> can use to install the files into a wanted directory structure.

Well... in this case, the libraries are only temporary and used during the build
of the final target.

>> So, basically, each package can depend on a number of include files and
>> libraries that have not yet been built, so somehow I need to specify
>>  rules for how to build it all in a good order.
> 
> Using target_link_libraries() already does this _if_ you defined the
> library with add_library() _before_ using target_link_libraries. You
> GLOB will apply alphabetic order. Don't use it if you need a specific
> order. Use an explicit list instead.

Well... in this case, I don't know the subdirectories that will be used, nor the
dependencies.

Only the subsystems know what dependencies they have on other items, so
therefore I would like to place the dependencies inside the packages, and the
dependencies are on specific library files and header that are made available
for other packages.

I was somehow hoping that CMake would resolve the dependencies, as long as they
are provided, and create a proper build order for all the subsystems (assuming,
of course, that the dependencies form a DAG).

Best wishes,
Mats Kindahl
-- 
Mats Kindahl
Senior Software Engineer
Database Technology Group
Sun Microsystems


More information about the CMake mailing list