Skip to content

Conversation

@Nowaterisenough
Copy link

@Nowaterisenough Nowaterisenough commented Jul 24, 2025

This occurred because the INTERFACE include directories were using absolute source paths that are invalid when the target is exported/installed to other systems.

Solution

  • Updated target_include_directories to use CMake generator expressions
  • Used $<BUILD_INTERFACE:...> for build-time include paths
  • Used $<INSTALL_INTERFACE:...> for install-time include paths
  • This ensures the target can be properly exported and used by external projects

Changes

  • Modified CMakeLists.txt to use proper generator expressions for include directories
  • Ensured compatibility with CMake's export/install mechanisms
  • Maintained backward compatibility for local builds

Testing

  • Local build completes successfully
  • CMake generation passes without errors
  • Target can be properly exported

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

@Nowaterisenough Nowaterisenough changed the title 复制 Update target_include_directories to support build and install interfaces Update target_include_directories to support build and install interfaces Jul 24, 2025
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

Successfully merging this pull request may close these issues.

1 participant