How to set project name in CMake

To set the name of the project:

project(foobar)

To use the project name that you set, use ${PROJECT_NAME} variable. For example, to set the name of the executable produced:

# Produces executable named "foobar"
add_executable(
    ${PROJECT_NAME}
    src/main.cpp
    src/helper.cpp
    )

Tried with: CMake 2.8.12.2 and Ubuntu 14.04

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s