[cmake-developers] [CMake 0014636]: Error with whitelisted properties and generator expression in target_link_libraries

Mantis Bug Tracker mantis at public.kitware.com
Sat Dec 7 04:42:59 EST 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14636 
====================================================================== 
Reported By:                Kiron
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14636
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-12-07 04:42 EST
Last Modified:              2013-12-07 04:42 EST
====================================================================== 
Summary:                    Error with whitelisted properties and generator
expression in target_link_libraries
Description: 
When using target_link_libraries to link an INTERFACE IMPORTED library with an
EXECUTABLE and the INTERFACE_LINK_LIBRARIES property of the library contains a
generator expression, the following FATAL_ERROR is produced:

(See Steps To Reproduce for CMakeLists.txt)

>cmake .
-- Configuring done
CMake Error in CMakeLists.txt:
  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
  property "IMPORTED_LOCATION_RELEASE" is not allowed.


CMake Error in CMakeLists.txt:
  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
  property "IMPORTED_LOCATION" is not allowed.


CMake Error in CMakeLists.txt:
  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
  property "IMPORTED_CONFIGURATIONS" is not allowed.


CMake Error in CMakeLists.txt:
  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
  property "IMPORTED_LOCATION_MINSIZEREL" is not allowed.


CMake Error in CMakeLists.txt:
  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
  property "IMPORTED_LOCATION" is not allowed.


CMake Error in CMakeLists.txt:
  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
  property "IMPORTED_CONFIGURATIONS" is not allowed.


CMake Error in CMakeLists.txt:
  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
  property "IMPORTED_LOCATION_RELWITHDEBINFO" is not allowed.


CMake Error in CMakeLists.txt:
  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
  property "IMPORTED_LOCATION" is not allowed.


CMake Error in CMakeLists.txt:
  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
  property "IMPORTED_CONFIGURATIONS" is not allowed.


CMake Error in CMakeLists.txt:
  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
  property "IMPORTED_LOCATION_NOCONFIG" is not allowed.


CMake Error in CMakeLists.txt:
  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
  property "IMPORTED_LOCATION" is not allowed.


CMake Error in CMakeLists.txt:
  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
  property "IMPORTED_CONFIGURATIONS" is not allowed.


-- Generating done
-- Build files have been written to: ...

When NOT using a generator expression in the INTERFACE_LINK_LIBRARIES property,
no error is generated.

Additionally, the error message does not provide detailed information to track
down this error.

Steps to Reproduce: 
Create a file CMakeLists.txt file with the following content:

------------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8.12.20131125 FATAL_ERROR)

project(GeneratorExpressionAndWhitelistedProperties C CXX)

set(_main_cpp ${CMAKE_CURRENT_BINARY_DIR}/main.cpp)
file(WRITE ${_main_cpp} 
  "int main(int argc, char** argv) { return 0; }\n"
)

add_library(foo::bar INTERFACE IMPORTED)
set_target_properties(foo::bar
  PROPERTIES
    INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}"
    # When not using a generator expression here, no error is generated
    INTERFACE_LINK_LIBRARIES "$<$<NOT:$<CONFIG:DEBUG>>:foo_bar.lib>"
)

add_executable(main ${_main_cpp})
target_include_directories(main PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")

target_link_libraries(main foo::bar)
------------------------------------------------------------------------------

Run cmake

Additional Information: 
cmake version 2.8.12.20131207-g6f6ee
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-12-07 04:42 Kiron          New Issue                                    
======================================================================




More information about the cmake-developers mailing list