Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 4,105
    • Issues 4,105
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 16
    • Merge requests 16
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMakeCMake
  • CMakeCMake
  • Issues
  • #19434
Closed
Open
Issue created Jun 29, 2019 by Avi Shukron@avraham.shukronContributor

UNKNOWN IMPORTED targets cannot have properties set using target_* commands

Let's say I'm writing a Find Module for an external package. Somewhere in the module I create the imported target:

add_library(MyLib UNKNOWN IMPORTED)

MyLib requires that some compile definitions be defined, so I want to call target_compile_definitions on it:

target_compile_definitions(MyLib INTERFACE "SOME_FOO")

But I get an error:

target_compile_definitions called with non-compilable target type

I can still set the property directly via set_target_properties though:

set_target_properties(MyLib PROPERTIES
      IMPORTED_LOCATION "${MyLib_LIBRARIES}"
      INTERFACE_COMPILE_OPTIONS "SOME_FOO")

Practically I don't see any reason why UNKNOWN IMPORTED targets have any restrictions on their properties. After all - they are designed to specifically convey usage requirements.

Edited Jun 29, 2019 by Avi Shukron
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking