ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

What does ${PROJECT_SOURCE_DIR} represents?

asked 2014-08-11 00:01:43 -0600

abcgarden gravatar image

In my CMakeList.txt, there is ${PROJECT_SOURCE_DIR} but I don't know the exact values it represents. So I enter something like "echo ${PROJECT_SOURCE_DIR}", but nothing comes out. My questions are: 1. how to find out what ${xxx} represents?
2. are there differences between ${} and $()?

edit retag flag offensive close merge delete



echo is not a CMake command, and ${PROJECT_SOURCE_DIR} is not an environment variable (so you can't echo it). If you want to print it, use message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") somewhere in your CMakeLists.txt.

gvdhoorn gravatar image gvdhoorn  ( 2014-08-11 01:57:42 -0600 )edit

Thank you @gvdhoorn, @BennyRe and @Wolf. The combination of your three answers is the perfect answer.

Winston gravatar image Winston  ( 2014-08-11 14:53:49 -0600 )edit

@gvdhoom thank you for your answer, please once you use message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") where would it be displayed/printed ?

aissa360 gravatar image aissa360  ( 2018-05-01 17:07:56 -0600 )edit

On the console, during CMake configuration phase.

gvdhoorn gravatar image gvdhoorn  ( 2018-05-02 01:33:25 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2014-08-11 02:01:14 -0600

BennyRe gravatar image

@Wolf gave the correct answer.

For further reading please refer to the CMake documentation of the variables:

edit flag offensive delete link more

answered 2014-08-11 01:44:40 -0600

Wolf gravatar image

It's the src folder for your project, where your package.xml and CMakeLists.txt lies, e. g.


if your user is names "your_username" , your catkin workspace is named "catkin_ws" and lies directly in your home folder and your package is named "your_package_name"........

edit flag offensive delete link more


Thank you. I think you are right. But my question goes furthur, in a general case,(not necessarily ROS), how to find out the meaning for ${}. gvdhoorn gives one possible answer.

abcgarden gravatar image abcgarden  ( 2014-08-11 09:53:59 -0600 )edit

Question Tools


Asked: 2014-08-11 00:01:43 -0600

Seen: 4,951 times

Last updated: Aug 11 '14