[cmake-developers] [CMake 0015142]: Cannot set different INTERFACE_COMPILE_DEFINITIONS for different IMPORTED_CONFIGURATIONS

Mantis Bug Tracker mantis at public.kitware.com
Mon Sep 8 14:20:19 EDT 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=15142 
====================================================================== 
Reported By:                Daniele E. Domenichelli
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15142
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-09-08 14:20 EDT
Last Modified:              2014-09-08 14:20 EDT
====================================================================== 
Summary:                    Cannot set different INTERFACE_COMPILE_DEFINITIONS
for different IMPORTED_CONFIGURATIONS
Description: 
The INTERFACE_COMPILE_DEFINITIONS target property does not have an
IMPORTED_CONFIGURATIONS_<CONFIG> analogue.

This means that it is not possible for imported libraries to use different
definitions depending on the configuration of the library being used.


Steps to Reproduce: 
In my opinion it should be possible to do something like this:

add_library(FOO::FOO IMPORTED UNKNOWN)
set_property(TARGET FOO::FOO PROPERTY INTERFACE_INCLUDE_DIRECTORIES
"${FOO_INCLUDE_DIRS}")
if(FOO_LIBRARY_RELEASE)
  set_property(TARGET FOO::FOO APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
  set_property(TARGET FOO::FOO PROPERTY IMPORTED_LOCATION_RELEASE
"${FOO_LIBRARY_RELEASE}")
  set_property(TARGET FOO::FOO APPEND PROPERTY
INTERFACE_COMPILE_DEFINITIONS_RELEASE FOO_RELEASE)
endif()
if(FOO_LIBRARY_DEBUG)
  set_property(TARGET FOO::FOO APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
  set_property(TARGET FOO::FOO PROPERTY IMPORTED_LOCATION_DEBUG
"${FOO_LIBRARY_DEBUG}")
  set_property(TARGET FOO::FOO APPEND PROPERTY
INTERFACE_COMPILE_DEFINITIONS_DEBUG FOO_DEBUG)
endif()

And depending on the configuration of the library being used, it should
automatically add -DFOO_RELEASE or -DFOO_DEBUG.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-09-08 14:20 Daniele E. DomenichelliNew Issue                               
    
======================================================================



More information about the cmake-developers mailing list