Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
544 views
in Technique[技术] by (71.8m points)

cmake - What is the difference between "${CMAKE_CURRENT_SOURCE_DIR}" and "." in INCLUDE_DIRECTORIES?

Should I use

INCLUDE_DIRECTORIES(
    .
)

or

INCLUDE_DIRECTORIES(
    ${CMAKE_CURRENT_SOURCE_DIR}
)

What is the difference, if any? I've seen mostly "." in existing code, but searching for a dot on the Internet is kind of difficult ...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Both uses generate nearly the same output, since CMake tracks the current directory and replaces the occurrence of "." with "${CMAKE_CURRENT_SOURCE_DIR}/.". The only difference is that the "." variant has the extra path component "/." appended.

Whichever you choose is a matter of taste here.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...