[cmake-developers] [CMake 0014561]: Errors with add_libaray(name INTERFACE) when TARGET_SUPPORTS_SHARED_LIBS is false

Mantis Bug Tracker mantis at public.kitware.com
Tue Nov 12 03:22:33 EST 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14561 
====================================================================== 
Reported By:                Kiron
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14561
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-11-12 03:22 EST
Last Modified:              2013-11-12 03:22 EST
====================================================================== 
Summary:                    Errors with add_libaray(name INTERFACE) when
TARGET_SUPPORTS_SHARED_LIBS  is false
Description: 
cmake version 2.8.12.20131111-g13da

When using add_libaray(name INTERFACE) command the following warnings/errors are
reported by cmake when TARGET_SUPPORTS_SHARED_LIBS is FALSE. Embedded cross
compile targets usually do not support shared libs. 

(see also Steps To Preproduce)

> cmake -H. -Bbuild
-- Building for: Visual Studio 11 2012
-- The C compiler identification is MSVC 17.0.60610.1
-- The CXX compiler identification is MSVC 17.0.60610.1
-- Check for working C compiler using: Visual Studio 11 2012
-- Check for working C compiler using: Visual Studio 11 2012 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 11 2012
-- Check for working CXX compiler using: Visual Studio 11 2012 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Warning (dev) at CMakeLists.txt:6 (add_library):
  ADD_LIBRARY called with MODULE option but the target platform does not
  support dynamic linking.  Building a STATIC library instead.  This may lead
  to problems.
This warning is for project developers.  Use -Wno-dev to suppress it.

You have called ADD_LIBRARY for library foo without any source files. This
typically indicates a problem with your CMake
Lists.txt file
-- Configuring done
CMake Error: CMake can not determine linker language for target: foo
-- Generating done
-- Build files have been written to: C:/xxx/build

> echo %ErrorLevel%
1

Steps to Reproduce: 
Create CMakeLists.txt with following content:


cmake_minimum_required(VERSION 2.8.12.20131009)
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
add_library(foo INTERFACE)

run following command:

cmake -H. -Bbuild
echo %ErrorLevel%
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-11-12 03:22 Kiron          New Issue                                    
======================================================================




More information about the cmake-developers mailing list