Skip to content

Use relative path to includedirs. - #8

Open
alex-rass-88 wants to merge 1 commit into
Jarod42:masterfrom
alex-rass-88:master
Open

Use relative path to includedirs.#8
alex-rass-88 wants to merge 1 commit into
Jarod42:masterfrom
alex-rass-88:master

Conversation

@alex-rass-88

Copy link
Copy Markdown

Full path for target_include_directories generates ugly paths on windows

This fix generates relative include paths for CMake.

Before:

target_include_directories("lua" PRIVATE
  /C/dev/projects/tests/third/lua/include
  /C/dev/projects/tests/third/lua/src
)

After:

target_include_directories("lua" PRIVATE
  ${CMAKE_CURRENT_SOURCE_DIR}/../../third/lua/include
  ${CMAKE_CURRENT_SOURCE_DIR}/../../third/lua/src
)

@Jarod42 Jarod42 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be problematic for paths which are not relative (d:/)
Is ${CMAKE_CURRENT_SOURCE_DIR}/ needed BTW, relative path use already that, no?

@alex-rass-88

alex-rass-88 commented May 9, 2026

Copy link
Copy Markdown
Author

Cmake sometimes misinterprets relative paths. Therefore, it is advisable to indicate where to start.
For complete paths, there are externalincludedirs

Comment thread cmake_project.lua
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.

2 participants