5

I'm creating an imported target which wishes to expose two interface include directories:

list(APPEND LIB_INCLUDE_DIRS "dir1")
list(APPEND LIB_INCLUDE_DIRS "dir2")

add_library(lib SHARED IMPORTED GLOBAL)
set_target_properties(
    lib
    PROPERTIES
    IMPORTED_LOCATION "something"
    INTERFACE_INCLUDE_DIRECTORIES ${LIB_INCLUDE_DIRS}
)

Unfortunately, there's an error: set_target_properties called with incorrect number of arguments.

If I try to set only the first directory, it works. Is there a way to set both? Or is the plural form of INTERFACE_INCLUDE_DIRECTORIES simply ironic?

krojew
  • 1,297
  • 15
  • 38

1 Answers1

8

Just put the directory list in quotes

set_target_properties(
    lib
    PROPERTIES
    IMPORTED_LOCATION "something"
    INTERFACE_INCLUDE_DIRECTORIES "${LIB_INCLUDE_DIRS}"
)

Otherwise the list is expanded again into parameters.

References

Community
  • 1
  • 1
Florian
  • 39,996
  • 9
  • 133
  • 149