MantisBT - CMake
View Issue Details
0014561CMakeCMakepublic2013-11-12 03:222014-06-02 08:37
Kiron 
Stephen Kelly 
normalminoralways
closedfixed 
Windows6.1
CMake 2.8.12 
CMake 3.0 
0014561: Errors with add_libaray(name INTERFACE) when TARGET_SUPPORTS_SHARED_LIBS is false
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
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%
No tags attached.
Issue History
2013-11-12 03:22KironNew Issue
2013-11-12 04:17Stephen KellyNote Added: 0034434
2013-11-12 04:17Stephen KellyStatusnew => resolved
2013-11-12 04:17Stephen KellyFixed in Version => CMake 3.0
2013-11-12 04:17Stephen KellyResolutionopen => fixed
2013-11-12 04:17Stephen KellyAssigned To => Stephen Kelly
2013-11-12 09:11Brad KingNote Edited: 0034434bug_revision_view_page.php?bugnote_id=34434#r1314
2014-06-02 08:37Robert MaynardNote Added: 0036009
2014-06-02 08:37Robert MaynardStatusresolved => closed

Notes
(0034434)
Stephen Kelly   
2013-11-12 04:17   
(edited on: 2013-11-12 09:11)
Fixed with

 add_library: Fix INTERFACE on platforms with no shared libs
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=64f73b0f [^]

Thanks,

(0036009)
Robert Maynard   
2014-06-02 08:37   
Closing resolved issues that have not been updated in more than 4 months.