Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] SYSTEM include workaround for older cmake versions #500

Open
poolfeast-420 opened this issue Aug 24, 2023 · 1 comment
Open

Comments

@poolfeast-420
Copy link

Cmake versions older than 3.25 do not have the SYSTEM target property.

Entries of INTERFACE_INCLUDE_DIRECTORIES are treated as system include directories when compiling consumers.

Its possible to move all INTERFACE_INCLUDE_DIRECTORIES to INTERFACE_SYSTEM_INCLUDE_DIRECTORIES manually with something like:

    # Grab the public includes from a target
    get_target_property(IID ${TARGET} INTERFACE_INCLUDE_DIRECTORIES)
    # Set the targets public includes as its system includes
    set_target_properties(${TARGET} PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${IID}")

Could CPM do this automatically based on the version?

From my understanding this could be transparent to users.

@patstew
Copy link

patstew commented Sep 4, 2023

You can also do:

set_target_properties(${TARGET} PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:${TARGET},INTERFACE_INCLUDE_DIRECTORIES>)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants